Revision: 201023 RCL_3 PDK_3.0.1
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 21 Jun 2010 17:43:00 +0300
branchRCL_3
changeset 14 13838cf40350
parent 12 af3fb27c7511
child 16 5fb7af913dfd
Revision: 201023 Kit: 2010125
wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_server.h
wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_get_available_iaps.h
wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_server.h
wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_settings.h
wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_types.h
wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_check_rcpi.cpp
wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_get_available_iaps.cpp
wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_roam.cpp
wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_server.cpp
wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_settings.cpp
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmserveru.def
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/conf/wlanengine.confml
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmserveru.def
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/rwlmserver.h
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtimpl.h
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanresultcache.h
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmclientserver.h
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmserver.h
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/rwlmserver.cpp
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanconversionutil.cpp
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanmgmtimpl.cpp
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanscanresultcache.cpp
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanticktimer.cpp
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmscanrequest.cpp
wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmserver.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacContextImpl.h
wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacContextImpl.inl
wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11InfrastructureMode.h
wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11State.h
wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Synchronize.h
wlan_bearer/wlanldd/wlan_common/umac_common/inc/umac_types.h
wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacactivemodepowermodemgr.h
wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacactivemodepowermodemgr.inl
wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdeeppsmodepowermodemgr.h
wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11infrastructurenormalmode.h
wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdynamicpowermodemgmtcntx.h
wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdynamicpowermodemgmtcntx.inl
wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaclightpsmodepowermodemgr.h
wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacnullsendcontroller.h
wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacnullsendcontroller.inl
wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacpowermodemgrbase.h
wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacContextImpl.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Associated.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Idle.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11InfrastructureMode.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11SoftReset.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11State.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Synchronize.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaConfigure.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/umacactivemodepowermodemgr.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdeeppsmodepowermodemgr.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11ibssnormalmode.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11infrastructurenormalmode.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdynamicpowermodemgmtcntx.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/umaclightpsmodepowermodemgr.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/umacnullsendcontroller.cpp
wlan_bearer/wlanldd/wlan_common/umac_common/src/umacpowermodemgrbase.cpp
wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/RWlanLogicalChannel.h
wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/RWlanLogicalChannel.inl
wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/WlanLogicalChannel.cpp
wlan_plat/wlan_management_api/inc/wlanmgmtcommon.h
wlan_plat/wlan_management_api/inc/wlanmgmtinterface.h
--- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_server.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_server.h	Mon Jun 21 17:43:00 2010 +0300
@@ -17,7 +17,7 @@
 */
 
 /*
-* %version: 31 %
+* %version: 32 %
 */
 
 #ifndef ABS_CORE_SERVER_H
@@ -106,7 +106,7 @@
      * @param request_id An unique identification for the request.
      * @param is_active_scan_allowed specifies whether active scanning is allowed.
      * @param iap_data_list containing list of iap data structures.
-     * @param iap_id_list list of iap ids are stored here on completion.
+     * @param iap_availability_list List of available IAPs.
      * @param iap_ssid_list List of possible secondary SSIDs.
      * @param scan_data contains the scan results
      */
@@ -114,7 +114,7 @@
         u32_t request_id,
         bool_t is_active_scan_allowed,
         core_type_list_c<core_iap_data_s>& iap_data_list,
-        core_type_list_c<u32_t>& iap_id_list,
+        core_type_list_c<core_iap_availability_data_s>& iap_availability_list,
         core_type_list_c<core_ssid_entry_s>* iap_ssid_list,
         ScanList& scan_data ) = 0;
 
--- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_get_available_iaps.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_get_available_iaps.h	Mon Jun 21 17:43:00 2010 +0300
@@ -15,6 +15,9 @@
 *
 */
 
+/*
+* %version: 18 %
+*/
 
 #ifndef CORE_OPERATION_GET_AVAILABLE_IAPS_H
 #define CORE_OPERATION_GET_AVAILABLE_IAPS_H
@@ -43,6 +46,9 @@
 
 public:
 
+    /**
+     * The possible states of the state machine.
+     */
     enum core_state_e
         {
         core_state_init = core_base_state_next,
@@ -64,12 +70,6 @@
         core_state_MAX
         };
 
-    struct core_scan_list_entry
-        {
-        core_mac_address_s bssid;
-        core_ssid_s ssid;
-        };
-
     /**
      * Constructor.
      *
@@ -80,9 +80,9 @@
      * @param adaptation pointer to upper adaptation
      * @param is_active_scan_allowed specifies whether to use probes or just listen to beacons
      * @param iap_data_list contains list of IAP data structures
-     * @param iap_ssid_list List of possible secondary SSIDs
-     * @param list of available IAP IDs on return
-     * @param scan data of found networks on return
+     * @param iap_availability_list List of available IAPs.
+     * @param iap_ssid_list List of possible secondary SSIDs.
+     * @param scan_data scan data of found networks on return
      */
     core_operation_get_available_iaps_c(
         u32_t request_id,
@@ -91,7 +91,7 @@
         abs_core_server_callback_c* adaptation,
         bool_t is_active_scan_allowed,
         core_type_list_c<core_iap_data_s>& iap_data_list,
-        core_type_list_c<u32_t>& iap_id_list,
+        core_type_list_c<core_iap_availability_data_s>& iap_availability_list,
         core_type_list_c<core_ssid_entry_s>* iap_ssid_list,
         ScanList& scan_data );
 
@@ -147,11 +147,6 @@
 private: // functions
 
     /**
-     * Remove IAPs that are not marked hidden from the list of IAPs to search.
-     */
-    void remove_non_hidden_iaps();
-
-    /**
      * Process the scan results using the given tag.
      *
      * @param tag Tag to use for iterating through the scan results.
@@ -210,6 +205,39 @@
         const core_ssid_s& ssid,
         const ScanList& scan_data );
 
+    /**
+     * Check whether the given SSID is present in the SSID list.
+     *
+     * @param ssid SSID to match.
+     * @param ssid_list SSID list to search.
+     * @return true_t if matching SSID is found, false_t otherwise.
+     */
+    bool_t is_ssid_in_list(
+        const core_ssid_s& ssid,
+        core_type_list_c<core_ssid_s>& ssid_list ) const;
+
+    /**
+     * Check whether the given IAP is present in the IAP availability list.
+     *
+     * @param iap_id IAP ID to match.
+     * @param iap_list IAP availability list to search.
+     * @return true_t if matching IAP is found, false_t otherwise.
+     */
+    bool_t is_iap_in_availability_list(
+        u32_t iap_id,
+        core_type_list_c<core_iap_availability_data_s>& iap_list ) const;
+
+    /**
+     * Add the given IAP to the IAP availability list. If an entry already exists,
+     * only signal strength is updated if needed.
+     *
+     * @param iap_id IAP ID to add.
+     * @param iap_rcpi Signal strength of the IAP.
+     */
+    void update_iap_availability(
+        u32_t iap_id,
+        u8_t iap_rcpi );
+
 private: // data
 
     /**
@@ -223,14 +251,19 @@
     bool_t is_limiting_algorithm_used_m;    
 
     /**
-     * Original list of IAPs.
+     * Number of IAPs.
+     */
+    u32_t iap_data_count_m;
+
+    /**
+     * List of IAPs.
      */
     core_type_list_c<core_iap_data_s>& iap_data_list_m;
 
     /**
-     * List for storing IDs of available IAPs.
+     * List of available IAPs.
      */
-    core_type_list_c<u32_t>& iap_id_list_m;
+    core_type_list_c<core_iap_availability_data_s>& iap_availability_list_m;
 
     /**
      * List of possible secondary SSIDs. Not owned by this pointer.
@@ -273,9 +306,14 @@
     u8_t bss_count_m;
 
     /**
-     * SSID being direct scanned.
+     * List of SSIDs to direct scan.
      */
-    core_ssid_s direct_scanned_ssid_m;
+    core_type_list_c<core_ssid_s> direct_scan_list_m;
+    
+    /**
+     * Iterator for direct scan list. 
+     */
+    core_type_list_iterator_c<core_ssid_s> direct_scan_iter_m;
 
     /**
      * Region information that is selected based on the APs country information.
--- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_server.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_server.h	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 55 %
+* %version: 56 %
 */
 
 #ifndef CORE_SERVER_H
@@ -501,7 +501,7 @@
      * @param request_id An unique identification for the request.
      * @param is_active_scan_allowed specifies whether active scanning is allowed.
      * @param iap_data_list containing list of iap data structures.
-     * @param iap_id_list list of iap ids are stored here on completion.
+     * @param iap_availability_list List of available IAPs.
      * @param iap_ssid_list List of possible secondary SSIDs.
      * @param scan_data contains the scan results
      */
@@ -509,7 +509,7 @@
         u32_t request_id,
         bool_t is_active_scan_allowed,
         core_type_list_c<core_iap_data_s>& iap_data_list,
-        core_type_list_c<u32_t>& iap_id_list,
+        core_type_list_c<core_iap_availability_data_s>& iap_availability_list,
         core_type_list_c<core_ssid_entry_s>* iap_ssid_list,
         ScanList& scan_data );
 
--- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_settings.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_settings.h	Mon Jun 21 17:43:00 2010 +0300
@@ -15,6 +15,9 @@
 *
 */
 
+/*
+* %version: 21 %
+*/
 
 #ifndef CORE_SETTINGS_H
 #define CORE_SETTINGS_H
@@ -444,31 +447,6 @@
      */
     void set_block_ack_usage(
         const core_block_ack_usage_s& usage );    
-    
-    /**
-     * Add a IAP ID to the weaklist.
-     *
-     * @since S60 v5.2
-     * @param iap_id IAP ID to be added.
-     */   
-    void add_iap_id_to_weak_iap_list(u32_t iap_id); 
-    
-    /**
-     * Check whether the given IAP ID is weaklisted.
-     *
-     * @since S60 v5.2
-     * @param iap_id IAP ID to be checked.
-     * @return Whether the given IAP ID is weaklisted.
-     */   
-    bool_t is_iap_id_in_weak_list( u32_t iap_id );
-    
-    /**
-     * Remove a IAP ID from the weaklist.
-     *
-     * @since S60 v5.2
-     * @param iap_id IAP ID to be removed.
-     */   
-    void remove_iap_id_from_weak_list( u32_t iap_id );
 
     /**
      * Set the currently enabled feature set.
@@ -554,9 +532,6 @@
     /** Block ACK usage per traffic stream. */
     core_block_ack_usage_s block_ack_usage_m;
 
-    /** List of IAP Ids whose rcpi values are weak  */
-    core_type_list_c<u32_t> weak_iap_list_m;
-
     /** Bitmask of enabled features. */
     u32_t features_m;
 
--- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_types.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_types.h	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 97 %
+* %version: 99 %
 */
 
 #ifndef CORE_TYPES_H
@@ -468,6 +468,7 @@
     core_error_wlan_disabled,
     core_error_already_exists,
     core_error_eapol_auth_start_timeout,
+    core_error_unsupported_config
     } core_error_e;
 
 /**
@@ -597,6 +598,7 @@
     core_connect_ap_signal_too_weak,
     core_connect_ap_has_no_admission_control,
     core_connect_ap_has_no_free_admission_capability,
+    core_connect_ap_unsupported_configuration,
     core_connect_iap_open_but_ap_requires_encryption,
     core_connect_iap_wep_but_ap_has_no_privacy,
     core_connect_iap_wep_but_ap_has_wpa_ie,
@@ -796,7 +798,6 @@
     {
     core_management_status_success                     = 0,
     core_management_status_unspecified_failure         = 1,
-    // 2 - 9 are reserved.
     core_management_status_unsupported_capabilities    = 10,
     core_management_status_reassociation_denied_other  = 11,
     core_management_status_association_denied_other    = 12,
@@ -809,10 +810,10 @@
     core_management_status_assoc_unsup_short_preamble  = 19,
     core_management_status_assoc_unsup_pbcc            = 20,
     core_management_status_assoc_unsup_channel_agility = 21,
-    // 22 - 24 reserved.
     core_management_status_assoc_unsup_short_slot_time = 25,
-    core_management_status_assoc_unsup_dsss_ofdm       = 26
-    // 27 - 65,535 reserved
+    core_management_status_assoc_unsup_dsss_ofdm       = 26,
+    core_management_status_assoc_unsup_ht_features     = 27,
+    core_management_status_assoc_unsup_pco             = 29
     } core_management_status_e;
 
 /**
@@ -1558,6 +1559,17 @@
     };
 
 /**
+ * Structure for storing IAP availability data.
+ */
+struct core_iap_availability_data_s
+    {
+    /** ID of the IAP. */
+    u32_t id;
+    /** Signal strength of the strongest AP in the network. */
+    u8_t rcpi;
+    };
+
+/**
  * Struct containing SSIDs related to secondary SSID feature.
  */
 struct core_ssid_entry_s
--- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_check_rcpi.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_check_rcpi.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 22 %
+* %version: 23 %
 */
 
 #include "core_operation_check_rcpi.h"
@@ -365,13 +365,7 @@
                 u8_t buf[5];
                 buf[0] = static_cast<u8_t>( core_rcp_weak );
                 buf[1] = static_cast<u8_t>( current_rcpi_m );
-                  
-                /**
-                 * Get current IAP Id value and add it to the weak list. 
-                 */
-                server_m->get_core_settings().add_iap_id_to_weak_iap_list(
-                     server_m->get_connection_data()->iap_data().iap_id());
-                 
+
                 adaptation_m->notify(
                     core_notification_rcp_changed,
                     sizeof( buf ),
--- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_get_available_iaps.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_get_available_iaps.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 41 %
+* %version: 44 %
 */
 
 #include "core_operation_get_available_iaps.h"
@@ -27,10 +27,9 @@
 #include "core_frame_dot11_ie.h"
 #include "am_debug.h"
 
-/** Defining this enables IAP related traces. */
-//#define WLAN_CORE_DEEP_DEBUG 1
-
-/** The channel time used in the long passive scan. */
+/** 
+ * The channel time used in the long passive scan.
+ */
 const u32_t LONG_PASSIVE_SCAN_CHANNEL_TIME = 210;
 
 /**
@@ -51,24 +50,24 @@
     abs_core_server_callback_c* adaptation,
     bool_t is_active_scan_allowed,
     core_type_list_c<core_iap_data_s>& iap_data_list,
-    core_type_list_c<u32_t>& iap_id_list,
+    core_type_list_c<core_iap_availability_data_s>& iap_availability_list,
     core_type_list_c<core_ssid_entry_s>* iap_ssid_list,
     ScanList& scan_data ) :
     core_operation_base_c( core_operation_get_available_iaps, request_id, server, drivers, adaptation,
         core_base_flag_drivers_needed ),    
     is_active_scan_allowed_m( is_active_scan_allowed ),
     is_limiting_algorithm_used_m( false_t ),
+    iap_data_count_m( iap_data_list.count() ),
     iap_data_list_m( iap_data_list ),
-    iap_id_list_m( iap_id_list ),
+    iap_availability_list_m( iap_availability_list ),
     iap_ssid_list_m( iap_ssid_list ),
     client_scan_data_m( scan_data ),
     active_channels_m( ),
     broadcast_channels_m( ),
     long_broadcast_count_m( 0 ),
-    non_found_iaps_list_m( ),
     is_split_scan_m( false_t ),
     bss_count_m( 0 ),
-    direct_scanned_ssid_m( ),
+    direct_scan_iter_m( direct_scan_list_m ), 
     region_from_ap_m( core_wlan_region_fcc )
     {
     DEBUG( "core_operation_get_available_iaps_c::core_operation_get_available_iaps_c()" );
@@ -83,7 +82,7 @@
 
     server_m->unregister_event_handler( this );
     server_m->unregister_frame_handler( this );
-    non_found_iaps_list_m.clear();
+    direct_scan_list_m.clear();
     iap_ssid_list_m = NULL;
     }
 
@@ -103,15 +102,13 @@
 #ifdef WLAN_CORE_DEEP_DEBUG
             DEBUG( "core_operation_get_available_iaps_c::next_state() - IAP data list:" );
 
-            core_iap_data_s* iter_data = iap_data_list_m.first();            
-            while( iter_data )
+            core_type_list_iterator_c<core_iap_data_s> iap_data_iter( iap_data_list_m );
+            for( core_iap_data_s* entry = iap_data_iter.first(); entry; entry = iap_data_iter.next() )
                 {
                 DEBUG1( "core_operation_get_available_iaps_c::next_state() - ID: %u",
-                    iter_data->id );
+                    entry->id );
                 DEBUG1S( "core_operation_get_available_iaps_c::next_state() - SSID: ",
-                    iter_data->ssid.length, iter_data->ssid.ssid );
-
-                iter_data = iap_data_list_m.next();
+                    entry->ssid.length, entry->ssid.ssid );
                 }
 
             if ( iap_ssid_list_m )
@@ -257,7 +254,6 @@
             const core_scan_channels_s channels(
                 server_m->get_core_settings().valid_scan_channels( broadcast_channels_m.channels() ) );
 
-
             if ( !is_active_scan_allowed_m ||
                  is_limiting_algorithm_used_m )
                 {
@@ -322,7 +318,7 @@
             	 * handled already */
             	return goto_state( core_state_broadcast_scan_done_handle_result );
             	}
-            
+
             operation_state_m = core_state_broadcast_scan_start_unknown_region;
 
             broadcast_channels_m.set(
@@ -472,7 +468,7 @@
                 }
 
             /**
-             * Go through the broadcast scan results and remove matching IAPs.
+             * Go through the broadcast scan results.
              */
             process_scan_results(
                 core_scan_list_tag_scan );
@@ -487,13 +483,37 @@
                    is_limiting_algorithm_used_m &&
                    bss_count_m ) )
                 {
-                remove_non_hidden_iaps();
+                /**
+                 * Gather a list of SSID to direct scan. Only IAPs marked
+                 * as hidden will be scanned. 
+                 */
+                core_type_list_iterator_c<core_iap_data_s> iap_data_iter( iap_data_list_m );
+                for( core_iap_data_s* entry = iap_data_iter.first(); entry; entry = iap_data_iter.next() )
+                    {
+                    if( entry->is_hidden &&
+                        !is_ssid_in_list(
+                            entry->ssid,
+                            direct_scan_list_m ) )
+                        {
+                        core_ssid_s* ssid = new core_ssid_s;
+                        if( ssid )
+                            {
+                            *ssid = entry->ssid;
+                            core_error_e ret = direct_scan_list_m.append( ssid );
+                            if( ret != core_error_ok )
+                                {
+                                delete ssid;
+                                }
+                            ssid = NULL;
+                            }
+                        }
+                    }
 
                 /**
                  * If limiting algorithm is used, only the current active_channels_m
                  * will be used.
                  */               
-                if ( is_limiting_algorithm_used_m )
+                if( is_limiting_algorithm_used_m )
                     {
                     DEBUG( "core_operation_get_available_iaps_c::next_state() - limiting channels based on WLAN activity" );
                     }
@@ -503,27 +523,18 @@
                         server_m->get_core_settings().all_valid_scan_channels() );
                     }
 
-                /**
-                 * iap_data_list_m now contains only hidden ssid IAPs,
-                 * that will be direct scanned next.
-                 */
-                core_iap_data_s* iap = iap_data_list_m.first();
-                if( !iap )
+                core_ssid_s* ssid = direct_scan_iter_m.first();
+                if( !ssid )
                     {
                     DEBUG( "core_operation_get_available_iaps_c::next_state() - nothing to direct scan" );
 
-                    /** No hidden IAP entries in the request, move on.. */
                     return goto_state( core_state_secondary_ssid_check );
                     }
 
-                DEBUG1( "core_operation_get_available_iaps_c::next_state() - going to direct scan %u IAP(s)",
-                    iap_data_list_m.count() );
-
-                direct_scanned_ssid_m = iap->ssid;
-                DEBUG1( "core_operation_get_available_iaps_c::next_state() - direct scanning IAP ID %u",
-                    iap->id );
-                DEBUG1S( "core_operation_get_available_iaps_c::next_state() - SSID: ",
-                    direct_scanned_ssid_m.length, direct_scanned_ssid_m.ssid );
+                DEBUG1( "core_operation_get_available_iaps_c::next_state() - going to direct scan %u SSID(s)",
+                    direct_scan_list_m.count() );
+                DEBUG1S( "core_operation_get_available_iaps_c::next_state() - direct scanning SSID: ",
+                    ssid->length, &ssid->ssid[0] );
 
                 server_m->get_scan_list().set_tag(
                     core_scan_list_tag_direct_scan );
@@ -542,7 +553,7 @@
                 drivers_m->scan(
                     request_id_m,
                     core_scan_mode_active,
-                    direct_scanned_ssid_m,
+                    *ssid,
                     server_m->get_device_settings().scan_rate,
                     channels,
                     server_m->get_device_settings().active_scan_min_ch_time,
@@ -554,7 +565,6 @@
             else
                 {
                 DEBUG( "core_operation_get_available_iaps_c::next_state() - no reason to direct scan anything" );
-                remove_non_hidden_iaps();
 
                 return goto_state( core_state_scanning_done );
                 }
@@ -571,8 +581,6 @@
 
             DEBUG1( "core_operation_get_available_iaps_c::next_state() - direct scan done, %u beacon(s)/probe(s) received",
                 bss_count_m );
-            DEBUG1( "core_operation_get_available_iaps_c::next_state() - max %u direct scans left",
-                iap_data_list_m.count() );           
 
             /**
              * Go through the direct scan results and remove the matching IAPs.
@@ -580,101 +588,70 @@
             process_scan_results(
                 core_scan_list_tag_direct_scan );
 
-            /**
-             * If the first entry is still the same the one that was scanned,
-             * it means the IAP was not found.
-             */
-            core_iap_data_s* iap = iap_data_list_m.first();
-            if ( iap && iap->ssid == direct_scanned_ssid_m )
-                {
-                DEBUG1( "core_operation_get_available_iaps_c::next_state() - IAP ID %u not found in direct scan",
-                    iap->id );
-
-                core_error_e ret = iap_data_list_m.remove( iap );
-                if( ret != core_error_ok )
-                    {
-                    DEBUG1( "core_operation_get_available_iaps_c::next_state() - error while removing IAP entry (%d)",
-                        ret );
-                    }
-
-                non_found_iaps_list_m.append( iap );
-                }
-
-            iap = iap_data_list_m.first();
-            if( iap )
-                {
-                direct_scanned_ssid_m = iap->ssid;
-                DEBUG1( "core_operation_get_available_iaps_c::next_state() - direct scanning IAP ID %u",
-                    iap->id );              
-                DEBUG1S( "core_operation_get_available_iaps_c::next_state() - SSID: ",
-                    direct_scanned_ssid_m.length, direct_scanned_ssid_m.ssid );
-
-                server_m->get_scan_list().set_tag(
-                    core_scan_list_tag_direct_scan );
-
-                const core_scan_channels_s& channels(
-                    active_channels_m.channels() );
-                DEBUG2( "core_operation_get_available_iaps_c::next_state() - requesting scan on channels 0x%02X%02X",
-                    channels.channels2dot4ghz[1],
-                    channels.channels2dot4ghz[0] );
-
-                bss_count_m = 0;
-
-                server_m->register_event_handler( this );
-                server_m->register_frame_handler( this );
-
-                drivers_m->scan(
-                    request_id_m,
-                    core_scan_mode_active,
-                    direct_scanned_ssid_m,
-                    server_m->get_device_settings().scan_rate,
-                    channels,
-                    server_m->get_device_settings().active_scan_min_ch_time,
-                    server_m->get_device_settings().active_scan_max_ch_time,
-                    is_split_scan_m );
-                }
-            else
+            core_ssid_s* ssid = direct_scan_iter_m.next();
+            if( !ssid )
                 {
                 DEBUG( "core_operation_get_available_iaps_c::next_state() - nothing to direct scan" );
 
                 return goto_state( core_state_secondary_ssid_check );
                 }
 
+            DEBUG1S( "core_operation_get_available_iaps_c::next_state() - direct scanning SSID: ",
+                ssid->length, &ssid->ssid[0] );
+
+            server_m->get_scan_list().set_tag(
+                core_scan_list_tag_direct_scan );
+
+            const core_scan_channels_s& channels(
+                active_channels_m.channels() );
+            DEBUG2( "core_operation_get_available_iaps_c::next_state() - requesting scan on channels 0x%02X%02X",
+                channels.channels2dot4ghz[1],
+                channels.channels2dot4ghz[0] );
+
+            bss_count_m = 0;
+
+            server_m->register_event_handler( this );
+            server_m->register_frame_handler( this );
+
+            drivers_m->scan(
+                request_id_m,
+                core_scan_mode_active,
+                *ssid,
+                server_m->get_device_settings().scan_rate,
+                channels,
+                server_m->get_device_settings().active_scan_min_ch_time,
+                server_m->get_device_settings().active_scan_max_ch_time,
+                is_split_scan_m );
+
             break;
             }
         case core_state_secondary_ssid_check:
             {
-            ASSERT( !iap_data_list_m.count() );
-            ASSERT( !iap_data_list_m.first() );
-
             /**
-             * All the IAPs that were not found are contained in non_found_iaps_list_m
-             * list. Those that have secondary SSIDs defined, will be moved back to
-             * iap_data_list_m for scanning.
+             * Remove all IAPs that have either been found or don't have
+             * secondary SSID defined.
              */
-
-            if ( iap_ssid_list_m )
+            if( iap_ssid_list_m )
                 {
-                core_iap_data_s* iap = non_found_iaps_list_m.first();
-                while( iap )
+                core_type_list_iterator_c<core_iap_data_s> iap_data_iter( iap_data_list_m );
+                for( core_iap_data_s* entry = iap_data_iter.first(); entry; entry = iap_data_iter.next() )
                     {
                     DEBUG1( "core_operation_get_available_iaps_c::next_state() - checking IAP ID %u for secondary SSIDs",
-                        iap->id );
+                        entry->id );
 
-                    if ( is_id_in_secondary_ssid_list( iap->id ) )
+                    if( !is_iap_in_availability_list(                        
+                            entry->id,
+                            iap_availability_list_m ) &&
+                        is_id_in_secondary_ssid_list(
+                            entry->id ) )
                         {
                         DEBUG( "core_operation_get_available_iaps_c::next_state() - IAP has secondary SSID(s) defined" );
-
-                        /** Using a temporary pointer to guarantee list iterator working. */
-                        core_iap_data_s* temp = iap;
-                        iap = non_found_iaps_list_m.next();
-
-                        non_found_iaps_list_m.remove( temp );
-                        iap_data_list_m.append( temp );
                         }
                     else
                         {
-                        iap = non_found_iaps_list_m.next();
+                        iap_data_iter.remove();
+                        delete entry;
+                        entry = NULL;
                         }
                     }
                 }
@@ -727,10 +704,8 @@
                             entry->ssid,
                             client_scan_data_m ) )
                         {                    
-                        direct_scanned_ssid_m = entry->used_ssid;
-
                         DEBUG1S( "core_operation_get_available_iaps_c::next_state() - matching SSID found, doing a direct scan for SSID ",
-                            direct_scanned_ssid_m.length, direct_scanned_ssid_m.ssid );
+                            entry->used_ssid.length, entry->used_ssid.ssid );
 
                         server_m->get_scan_list().set_tag(
                             core_scan_list_tag_direct_scan );
@@ -749,7 +724,7 @@
                         drivers_m->scan(
                             request_id_m,
                             core_scan_mode_active,
-                            direct_scanned_ssid_m,
+                            entry->used_ssid,
                             server_m->get_device_settings().scan_rate,
                             channels,
                             server_m->get_device_settings().active_scan_min_ch_time,
@@ -776,7 +751,8 @@
 
             remove_secondary_ssid_entries_by_id( iap->id );            
             iap_data_list_m.remove( iap );
-            non_found_iaps_list_m.append( iap );
+            delete iap;
+            iap = NULL;
             (void)iap_ssid_list_m->first();
             (void)iap_data_list_m.first();
 
@@ -799,7 +775,7 @@
             core_scan_list_iterator_by_tag_and_ssid_c iter(
                 server_m->get_scan_list(),
                 core_scan_list_tag_direct_scan,
-                direct_scanned_ssid_m );
+                entry->used_ssid );
 
             for ( core_ap_data_c* ap_data = iter.first(); ap_data; ap_data = iter.next() )
                 {
@@ -815,14 +791,9 @@
                     DEBUG1( "core_operation_get_available_iaps_c::next_state() - secondary SSID match for IAP ID %u",
                         iap->id );
 
-                    u32_t* iap_id = new u32_t;
-                    if( iap_id )
-                        {
-                        *iap_id = iap->id;
-                        iap_id_list_m.append( iap_id );
-                        iap_id = NULL;
-                        }
-
+                    update_iap_availability(
+                        iap_data.id(),
+                        ap_data->rcpi() );
                     remove_secondary_ssid_entries_by_id( iap->id );
                     iap_data_list_m.remove( iap );
                     (void)iap_ssid_list_m->first();
@@ -836,7 +807,7 @@
                 }
 
             DEBUG1S( "core_operation_get_available_iaps_c::next_state() - no matching SSID ",
-                direct_scanned_ssid_m.length, direct_scanned_ssid_m.ssid );
+                entry->used_ssid.length, entry->used_ssid.ssid );
 
             (void)iap_ssid_list_m->next();
 
@@ -854,9 +825,9 @@
             DEBUG1( "core_operation_get_available_iaps_c::next_state() - scan list size is %u bytes",
                 client_scan_data_m.Size() );
             DEBUG1( "core_operation_get_available_iaps_c::next_state() - %u IAP(s) found",
-                iap_id_list_m.count() );
+                iap_availability_list_m.count() );
             DEBUG1( "core_operation_get_available_iaps_c::next_state() - %u IAP(s) not found",
-                non_found_iaps_list_m.count() );
+                iap_data_count_m - iap_availability_list_m.count() );
 
             /**
              * Detect channels that have APs with long beacon intervals.
@@ -950,41 +921,6 @@
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
-void core_operation_get_available_iaps_c::remove_non_hidden_iaps()
-    {
-    DEBUG("core_operation_get_available_iaps_c::remove_non_hidden_iaps()");
-
-    core_iap_data_s* iap = iap_data_list_m.first();
-    while( iap )
-        {
-        if( !iap->is_hidden )
-            {
-            DEBUG1("core_operation_get_available_iaps_c::remove_non_hidden_iaps() - removing IAP ID %u",
-                iap->id );
-            
-            core_iap_data_s* temp = iap;
-            iap = iap_data_list_m.next();
-            core_error_e ret = iap_data_list_m.remove( temp );
-            if( ret != core_error_ok )
-                {
-                DEBUG1("core_operation_get_available_iaps_c::remove_non_hidden_iaps() - error while removing IAP entry (%d)",
-                    ret );
-                }
-            non_found_iaps_list_m.append( temp );
-            }
-        else
-            {
-            DEBUG1("core_operation_get_available_iaps_c::remove_non_hidden_iaps() - leaving IAP ID %u",
-                iap->id );
-
-            iap = iap_data_list_m.next();
-            }
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
-//
 void core_operation_get_available_iaps_c::process_scan_results(
     u8_t tag )
     {
@@ -1007,26 +943,17 @@
     core_ap_data_c& ap_data )
     {
     DEBUG( "core_operation_get_available_iaps_c::remove_matching_iaps()" );
-        
-    if ( ap_data.rcpi() < server_m->get_device_settings().iap_availability_rcpi_threshold )
-        {
-        DEBUG2( "core_operation_get_available_iaps_c::remove_matching_iaps() - AP not considered, signal too weak (%u vs %u)",
-            ap_data.rcpi(), server_m->get_device_settings().iap_availability_rcpi_threshold );
+
+    core_mac_address_s bssid = ap_data.bssid();
 
-        return;
-        }
-    
-    u8_t treshold_val = 
-        static_cast<u8_t>(server_m->get_core_settings().rcp_improve_boundary());
-        
     /**
-     * Loop through the IAP list.
+     * Loop through the list of IAPs.
      */
-    core_iap_data_s* iap = iap_data_list_m.first();
-    while( iap )
+    core_type_list_iterator_c<core_iap_data_s> iap_data_iter( iap_data_list_m );
+    for( core_iap_data_s* entry = iap_data_iter.first(); entry; entry = iap_data_iter.next() )
         {
-        core_iap_data_c iap_data( *iap );
-        if ( iap->ssid == ap_data.ssid() &&
+        core_iap_data_c iap_data( *entry );
+        if ( iap_data.ssid() == ap_data.ssid() &&
              core_tools_parser_c::is_ap_compatible_with_iap(
                 server_m->get_wpx_adaptation_instance(),
                 ap_data,
@@ -1035,57 +962,14 @@
                 false_t,
                 false_t ) == core_connect_ok )
             {
-            DEBUG1("core_operation_get_available_iaps_c::remove_matching_iaps() - match found for IAP ID %u",
-                iap->id );            
-
-            u32_t* iap_id = new u32_t;
-            if( iap_id )
-                {
-                if ( server_m->get_core_settings().is_iap_id_in_weak_list( iap->id) ) 
-                    {
-                    DEBUG( "core_operation_get_available_iaps_c::remove_matching_iaps() - IAP ID is in weak list" );
-                    
-                    if ( ap_data.rcpi() > treshold_val )
-                        {
-                        DEBUG( "core_operation_get_available_iaps_c::remove_matching_iaps() - RCPI improved enough, remove IAP ID from weak list" );
-                        *iap_id = iap->id;
-                        iap_id_list_m.append( iap_id );
-            		    iap_id = NULL;
-                        
-                        server_m->get_core_settings().remove_iap_id_from_weak_list( iap->id );
-                        }
+            DEBUG7("core_operation_get_available_iaps_c::remove_matching_iaps() - BSSID %02X:%02X:%02X:%02X:%02X:%02X matches IAP ID %u",
+                bssid.addr[0], bssid.addr[1], bssid.addr[2], 
+                bssid.addr[3], bssid.addr[4], bssid.addr[5], 
+                iap_data.id() );
 
-                    }
-                else
-                    {
-                    *iap_id = iap->id;
-                    iap_id_list_m.append( iap_id );
-                    iap_id = NULL;
-                    }
-                }
-
-            /** Using a temporary pointer to guarantee list iterator working. */
-            core_iap_data_s* temp = iap;
-            
-            iap = iap_data_list_m.next();
-            core_error_e ret = iap_data_list_m.remove( temp );
-            if( ret != core_error_ok )
-                {
-                if( iap )
-                    {
-                    DEBUG1("core_operation_get_available_iaps_c::remove_matching_iaps() - error while removing IAP entry (%d)",
-                        iap->id );                   
-                    }
-                }
-
-            delete temp;
-            temp = NULL;
-            delete iap_id;
-            iap_id = NULL;
-            }
-        else
-            {
-            iap = iap_data_list_m.next();
+            update_iap_availability(
+                iap_data.id(),
+                ap_data.rcpi() ); 
             }
         }
     }
@@ -1231,6 +1115,96 @@
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
+//
+bool_t core_operation_get_available_iaps_c::is_ssid_in_list(
+    const core_ssid_s& ssid,
+    core_type_list_c<core_ssid_s>& ssid_list ) const
+    {
+    core_type_list_iterator_c<core_ssid_s> ssid_iter( ssid_list );
+    for( core_ssid_s* entry = ssid_iter.first(); entry; entry = ssid_iter.next() )
+        {
+        if( *entry == ssid )
+            {
+            return true_t;
+            }
+        }
+
+    return false_t;
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+bool_t core_operation_get_available_iaps_c::is_iap_in_availability_list(
+    u32_t iap_id,
+    core_type_list_c<core_iap_availability_data_s>& iap_list ) const
+    {
+    core_type_list_iterator_c<core_iap_availability_data_s> iap_iter( iap_list );
+    for( core_iap_availability_data_s* entry = iap_iter.first(); entry; entry = iap_iter.next() )
+        {
+        if( entry->id == iap_id )
+            {
+            return true_t;
+            }
+        }
+
+    return false_t;
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void core_operation_get_available_iaps_c::update_iap_availability(
+    u32_t iap_id,
+    u8_t iap_rcpi )
+    {
+    core_type_list_iterator_c<core_iap_availability_data_s> iap_iter( iap_availability_list_m );
+    bool_t is_found( false_t );
+    core_iap_availability_data_s* entry = iap_iter.first();
+    while( entry && !is_found )
+        {
+        if( entry->id == iap_id )
+            {
+            is_found = true_t;
+            if( entry->rcpi < iap_rcpi )
+                {
+                DEBUG3("core_operation_get_available_iaps_c::update_iap_availability() - IAP %u already available, RCPI improved from %u to %u",
+                    iap_id, entry->rcpi, iap_rcpi );
+
+                entry->rcpi = iap_rcpi;
+                }
+            else
+                {
+                DEBUG3("core_operation_get_available_iaps_c::update_iap_availability() - IAP %u already available, RCPI not improved (%u vs %u)",
+                    iap_id, iap_rcpi, entry->rcpi );            
+                }
+            }
+
+        entry = iap_iter.next();
+        }
+
+    if( !is_found )
+        {
+        core_iap_availability_data_s* data = new core_iap_availability_data_s;
+        if( data )        
+            {
+            DEBUG2("core_operation_get_available_iaps_c::update_iap_availability() - IAP %u marked as available, RCPI is %u",
+                iap_id, iap_rcpi );
+
+            data->id = iap_id;
+            data->rcpi = iap_rcpi;
+            core_error_e ret = iap_availability_list_m.append( data );
+            if( ret != core_error_ok )
+                {
+                delete data;
+                }
+            data = NULL;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
 //    
 bool_t core_operation_get_available_iaps_c::receive_frame(
     const core_frame_dot11_c* frame,
--- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_roam.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_roam.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 76.1.2 %
+* %version: 76.1.5 %
 */
 
 #include "core_operation_roam.h"
@@ -433,6 +433,12 @@
                         bssid.addr[0], bssid.addr[1], bssid.addr[2],
                         bssid.addr[3], bssid.addr[4], bssid.addr[5] );
 
+                    /**
+                     * is_eapol_disconnecting is not updated here because this disassociation
+                     * is for the previous AP and thus we don't really care when this
+                     * request gets completed.
+                     */
+
                     server_m->get_eapol_instance().disassociation( &network );
                     }
                 }
@@ -796,21 +802,21 @@
     core_management_status_e management_status )
     {
     DEBUG( "core_operation_roam_c::connect_status()" );
-    
+
     core_iap_data_c& iap_data( server_m->get_connection_data()->iap_data() );
 
-    if ( management_status == core_management_status_assoc_denied_full_ap )
-        {
-        DEBUG( "core_operation_roam_c::connect_status() - AP full" );
-        return core_connect_ap_full;
-        }
-
     if ( request_status == core_error_eapol_auth_start_timeout )
         {
         DEBUG( "core_operation_roam_c::connect_status() - EAPOL authentication timeout before authentication was started" );
         return core_connect_eapol_auth_start_timeout;
         }
 
+    if ( request_status == core_error_unsupported_config )
+        {
+        DEBUG( "core_operation_roam_c::connect_status() - AP has an unsupported configuration" );
+        return core_connect_ap_unsupported_configuration;
+        }
+
     switch( iap_data.security_mode() )
         {
         case core_security_mode_wep:
@@ -919,6 +925,20 @@
             }
         }
 
+    if ( management_status == core_management_status_assoc_denied_full_ap )
+        {
+        DEBUG( "core_operation_roam_c::connect_status() - AP full" );
+        return core_connect_ap_full;
+        }
+
+    if ( management_status == core_management_status_unsupported_capabilities ||
+         management_status == core_management_status_assoc_unsup_basic_rates ||
+         management_status == core_management_status_assoc_unsup_ht_features )
+        {
+        DEBUG( "core_operation_roam_c::connect_status() - AP has an unsupported configuration" );
+        return core_connect_ap_unsupported_configuration;
+        }
+
     return core_connect_undefined;
     }
 
@@ -945,6 +965,15 @@
         }
 
     /**
+     * Unsupported configuration is always fatal.
+     */
+    if( request_status == core_error_unsupported_config )
+        {
+        DEBUG( "core_operation_roam_c::is_fatal_failure() - fatal, unsupported configuration" );
+        return core_ap_blacklist_reason_association_status;
+        }
+
+    /**
      * Don't consider a failed (re-)association attempt as fatal since it's
      * possible AP just doesn't have our authentication cached any more.
      */
--- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_server.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_server.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 90 %
+* %version: 91 %
 */
 
 #include "core_server.h"
@@ -1104,7 +1104,7 @@
     u32_t request_id,
     bool_t is_active_scan_allowed,
     core_type_list_c<core_iap_data_s>& iap_data_list,
-    core_type_list_c<u32_t>& iap_id_list,
+    core_type_list_c<core_iap_availability_data_s>& iap_availability_list,
     core_type_list_c<core_ssid_entry_s>* iap_ssid_list,
     ScanList& scan_data )
     {
@@ -1117,7 +1117,7 @@
         &callback_m, 
         is_active_scan_allowed, 
         iap_data_list, 
-        iap_id_list,
+        iap_availability_list,
         iap_ssid_list,
         scan_data );
 
--- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_settings.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_settings.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -15,6 +15,9 @@
 *
 */
 
+/*
+* %version: 26 %
+*/
 
 #include "core_settings.h"
 #include "core_settings_default.h"
@@ -45,7 +48,6 @@
     uapsd_settings_m( DEFAULT_UAPSD_SETTINGS ),
     power_save_settings_m( DEFAULT_POWER_SAVE_SETTINGS ),
     block_ack_usage_m( DEFAULT_BLOCK_ACK_USAGE ),
-    weak_iap_list_m( ),
 	features_m( features )
     {
     DEBUG1( "core_settings_c::core_settings_c() - features: 0x%08X",
@@ -67,7 +69,6 @@
     
     perm_whitelist_m.clear();
     perm_blacklist_m.clear();
-    weak_iap_list_m.clear();
     }
 
 // ---------------------------------------------------------------------------
@@ -690,61 +691,6 @@
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
-// 
-void core_settings_c::add_iap_id_to_weak_iap_list( u32_t iap_id )
-    {
-    if ( !is_iap_id_in_weak_list( iap_id ) )
-        {
-        u32_t* weak_iap_id = new u32_t;
-        if ( weak_iap_id )
-            {
-            *weak_iap_id = iap_id;
-            weak_iap_list_m.append( weak_iap_id );
-            }                        
-        }       
-    }
-
-// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
-// 
-bool_t core_settings_c::is_iap_id_in_weak_list( u32_t iap_id )
-    {
-    u32_t* iap_id_p = weak_iap_list_m.first();    
-    while ( iap_id_p )
-        {
-        if ( *iap_id_p == iap_id )
-            {
-            return true_t;
-            }
-        
-        iap_id_p = weak_iap_list_m.next();
-        }        
-
-    return false_t;
-    }
-
-// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
-// 
-void core_settings_c::remove_iap_id_from_weak_list( u32_t iap_id )
-    {
-    u32_t* iap_id_p = weak_iap_list_m.first();        
-    while ( iap_id_p )
-        {
-        if ( *iap_id_p == iap_id )
-            {
-            weak_iap_list_m.remove( iap_id_p );
-            delete iap_id_p;
-
-            return;
-            }
-        
-        iap_id_p = weak_iap_list_m.next();
-        }       
-    }
-
-// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
 //
 void core_settings_c::set_enabled_features(
     u32_t features )
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmserveru.def	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmserveru.def	Mon Jun 21 17:43:00 2010 +0300
@@ -31,7 +31,7 @@
 	?CancelDirectedRoam@RWLMServer@@QAEXXZ @ 30 NONAME ; void RWLMServer::CancelDirectedRoam(void)
 	?GetAcTrafficStatus@RWLMServer@@QAEHAAV?$TFixedArray@W4TWlmAcTrafficStatus@@$03@@@Z @ 31 NONAME ; int RWLMServer::GetAcTrafficStatus(class TFixedArray<enum TWlmAcTrafficStatus, 4> &)
 	?GetScanResults@RWLMServer@@QAEHAAVScanList@@ABVTDesC8@@AAHAAI@Z @ 32 NONAME ; int RWLMServer::GetScanResults(class ScanList &, class TDesC8 const &, int &, unsigned int &)
-	?GetAvailableIaps@RWLMServer@@QAEXAAVTDes8@@00AAVTRequestStatus@@@Z @ 33 NONAME ; void RWLMServer::GetAvailableIaps(class TDes8 &, class TDes8 &, class TDes8 &, class TRequestStatus &)
+	?GetAvailableIaps@RWLMServer@@QAEXAAVTDes8@@00HAAVTRequestStatus@@@Z @ 33 NONAME ; void RWLMServer::GetAvailableIaps(class TDes8 &, class TDes8 &, class TDes8 &, int, class TRequestStatus &)
 	?GetConnectionState@RWLMServer@@QAE?AW4TWlanConnectionState@@XZ @ 34 NONAME ; enum TWlanConnectionState RWLMServer::GetConnectionState(void)
 	?CancelDeleteTrafficStream@RWLMServer@@QAEXXZ @ 35 NONAME ; void RWLMServer::CancelDeleteTrafficStream(void)
 	?DeleteTrafficStream@RWLMServer@@QAEXAAVTRequestStatus@@I@Z @ 36 NONAME ; void RWLMServer::DeleteTrafficStream(class TRequestStatus &, unsigned int)
@@ -39,7 +39,7 @@
 	?NotifyChangedSettings@RWLMServer@@QAEXXZ @ 38 NONAME ; void RWLMServer::NotifyChangedSettings(void)
 	?GetSystemMode@RWLMServer@@QAEHAAW4TWlanSystemMode@@@Z @ 39 NONAME ; int RWLMServer::GetSystemMode(enum TWlanSystemMode &)
 	?Join@RWLMServer@@QAEXAAVTRequestStatus@@KPAUTWLMOverrideSettings@@@Z @ 40 NONAME ; void RWLMServer::Join(class TRequestStatus &, unsigned long, struct TWLMOverrideSettings *)
-	?GetAvailableIaps@RWLMServer@@QAEHAAUTWlmAvailableIaps@@AAHAAI@Z @ 41 NONAME ; int RWLMServer::GetAvailableIaps(struct TWlmAvailableIaps &, int &, unsigned int &)
+	?GetAvailableIaps@RWLMServer@@QAEHAAUTWlmAvailableIaps@@AAHAAIH@Z @ 41 NONAME ; int RWLMServer::GetAvailableIaps(struct TWlmAvailableIaps &, int &, unsigned int &, int)
 	?CancelNotifies@RWLMServer@@QAEXXZ @ 42 NONAME ; void RWLMServer::CancelNotifies(void)
 	?UpdateRcpNotificationBoundary@RWLMServer@@QAEHJJ@Z @ 43 NONAME ; int RWLMServer::UpdateRcpNotificationBoundary(long, long)
 	?CancelJoin@RWLMServer@@QAEXXZ @ 44 NONAME ; void RWLMServer::CancelJoin(void)
Binary file wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/conf/wlanengine.confml has changed
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmserveru.def	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmserveru.def	Mon Jun 21 17:43:00 2010 +0300
@@ -10,8 +10,8 @@
 	_ZN10RWLMServer14GetScanResultsER8ScanListRK6TDesC8RiRj @ 9 NONAME
 	_ZN10RWLMServer14GetScanResultsER8ScanListRK6TDesC8RiRjR14TRequestStatus @ 10 NONAME
 	_ZN10RWLMServer15GetSecurityModeER13TWlanSecurity @ 11 NONAME
-	_ZN10RWLMServer16GetAvailableIapsER17TWlmAvailableIapsRiRj @ 12 NONAME
-	_ZN10RWLMServer16GetAvailableIapsER5TDes8S1_S1_R14TRequestStatus @ 13 NONAME
+	_ZN10RWLMServer16GetAvailableIapsER17TWlmAvailableIapsRiRji @ 12 NONAME
+	_ZN10RWLMServer16GetAvailableIapsER5TDes8S1_S1_iR14TRequestStatus @ 13 NONAME
 	_ZN10RWLMServer16GetPowerSaveModeER14TWlanPowerSave @ 14 NONAME
 	_ZN10RWLMServer16GetUapsdSettingsER18TWlanUapsdSettings @ 15 NONAME
 	_ZN10RWLMServer16SetPowerSaveModeE18TWlanPowerSaveMode @ 16 NONAME
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/rwlmserver.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/rwlmserver.h	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 25 %
+* %version: 25.1.1 %
 */
 
 #ifndef RWLMSERVER_H
@@ -232,18 +232,21 @@
         * @param aAvailableIaps Array of IAP IDs available.
         * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept.
         * @param aMaxDelay maximum time (in seconds) the client is willing to wait for the scan results.
+        * @param aFilteredResults Whether availability is filtered based on signal strength.
         * @return General Symbian error code.
         */
         IMPORT_C TInt GetAvailableIaps(
             TWlmAvailableIaps& aAvailableIaps,
             TInt& aCacheLifetime,
-            TUint& aMaxDelay );
+            TUint& aMaxDelay,
+            TBool aFilteredResults );
 
         /**
          * Get available WLAN IAPs.
          * @param aAvailableIaps Array of IAP IDs available.
          * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept.
          * @param aMaxDelay maximum time (in seconds) the client is willing to wait for the scan results.
+         * @param aFilteredResults Whether availability is filtered based on signal strength.
          * @param aStatus Status of the calling active object.
          *
          * In order to call this method, an instance of TWlmAvailableIaps must
@@ -258,6 +261,7 @@
              TDes8& aAvailableIaps,
              TDes8& aCacheLifetime,
              TDes8& aMaxDelay,
+             TBool aFilteredResults,
              TRequestStatus& aStatus );
         
         /**
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtimpl.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtimpl.h	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 21 %
+* %version: 21.1.1 %
 */
 
 #ifndef WLANMGMTIMPL_H
@@ -375,6 +375,7 @@
             TWlanConnectionExtentedSecurityMode& aMode );        
 
         /**
+         * (From MWlanMgmtInterface)
          * Activate the extended notification service.
          * 
          * After the client has enabled the notification service, it can
@@ -389,6 +390,7 @@
             TUint aCallbackInterfaceVersion );
 
         /**
+         * (From MWlanMgmtInterface)
          * Create a virtual traffic stream.
          *
          * @param aStatus Status of the calling active object. On successful
@@ -407,11 +409,13 @@
             TWlanTrafficStreamStatus& aStreamStatus );
 
         /**
+         * (From MWlanMgmtInterface)
          * Cancel an outstanding traffic stream creation request.
          */
         virtual void CancelCreateTrafficStream();
 
         /**
+         * (From MWlanMgmtInterface)
          * Delete a virtual traffic stream.
          *
          * @param aStatus Status of the calling active object. On successful
@@ -424,11 +428,13 @@
             TUint aStreamId );
 
         /**
+         * (From MWlanMgmtInterface)
          * Cancel an outstanding traffic stream deletion request.
          */
         virtual void CancelDeleteTrafficStream();
 
         /**
+         * (From MWlanMgmtInterface)
          * Initiate a roam to the given BSSID.
          *
          * @param aStatus Status of the calling active object. On successful
@@ -442,6 +448,7 @@
             const TWlanBssid& aBssid );
 
         /**
+         * (From MWlanMgmtInterface)
          * Cancel an outstanding directed roam request.
          */
         virtual void CancelDirectedRoam();
@@ -454,6 +461,7 @@
             TInt aStatus );
 
         /**
+         * (From MWlanMgmtInterface)
          * Start aggressive background scanning.
          * @param aInterval Scan interval for aggressive mode (in seconds).
          *                  Valid range: 1-120 seconds.
@@ -461,6 +469,37 @@
         virtual TInt StartAggressiveBgScan(
             TUint aInterval );
 
+        /**
+         * (From MWlanMgmtInterface)
+         * Get the available WLAN IAPs.
+         *
+         * @param aCacheLifetime Defines how many seconds old cached results the client
+         *                       is willing to accept. The valid is range is from 0 to
+         *                       60 seconds. The value of -1 means the system default will
+         *                       be used. The aCacheLifetime parameter has a meaning only
+         *                       when the aMaxDelay parameter is zero.
+         *                       Value will be changed to the actual value used by the
+         *                       system.
+         * @param aMaxDelay Maximum amount of seconds the client is willing to wait for
+         *                  the availability results. The valid range is from 0 to 1200
+         *                  seconds or KWlanInfiniteScanDelay. KWlanInfiniteScanDelay
+         *                  will never cause a scan, but the request will be
+         *                  completed when any other broadcast scan request is completed.
+         *                  Value will be changed to the actual value used by the system.
+         * @param aFilteredResults Whether availability is filtered based on signal strength.
+                                   ETrue if filtering is allowed, EFalse if not.
+         * @param aStatus Status of the calling active object. On successful
+         *                completion contains KErrNone, otherwise one of the
+         *                system-wide error codes.
+         * @param aAvailableIaps Array of IAPs available.
+         */
+        virtual void GetAvailableIaps(
+            TInt& aCacheLifetime,
+            TUint& aMaxDelay,
+            TBool aFilteredResults,
+            TRequestStatus& aStatus,
+            RArray<TWlanIapAvailabilityData>& aAvailableIaps );
+
 	protected: // Methods
 
         /**
@@ -686,6 +725,23 @@
             TUint& aMaxDelay );
 
         /**
+         * C++ default constructor.
+         * @param aCallback Callback interface to CWlanMgmtImpl.
+         * @param aServer Interface to RWLMServer. 
+         * @param aAvailableIaps Available IAPs are stored here.
+         * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept.
+         * @param aMaxDelay maximum time the client is willing to wait for the scan results.
+         * @param aFilteredResults Whether availability is filtered based on signal strength.
+         */
+        CWlanAvailableIapsRequest(
+            CWlanMgmtImpl& aCallback,
+            RWLMServer& aServer,
+            RArray<TWlanIapAvailabilityData>& aAvailableIaps,
+            TInt& aCacheLifetime,
+            TUint& aMaxDelay,
+            TBool aFilteredResults );
+
+        /**
          * Destructor.
          */
         virtual ~CWlanAvailableIapsRequest();
@@ -728,12 +784,17 @@
         // Interface to RWLMServer
         RWLMServer& iServer;
 
-        // Handle to client storage for available IAPs
-		RArray<TUint>& iPendingAvailableIaps;
-		
+        // Handle to client storage for available IAP IDs for legacy methods.
+        // Not owned by this pointer.
+        RArray<TUint>* iPendingAvailableIapIds;
+
+        // Handle to client storage for available IAPs.
+        // Not owned by this pointer.
+        RArray<TWlanIapAvailabilityData>* iPendingAvailableIaps;
+
 		// Storage for available IAPs
 		TWlmAvailableIaps iAvailableIaps;
-		
+
 		// The package buffer needed for the asynchronous request
 		TPckg<TWlmAvailableIaps> iAvailableIapsBuf;
 		
@@ -743,6 +804,8 @@
 		// The package buffer needed for the asynchronous request
 		TPckg<TUint> iMaxDelayBuf;
 		
+		// Whether availability is filtered based on signal strength.
+		TBool iFilteredResults;
     };
 
 
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanresultcache.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanresultcache.h	Mon Jun 21 17:43:00 2010 +0300
@@ -15,6 +15,9 @@
 *
 */
 
+/*
+* %version: 13 %
+*/
 
 #ifndef WLANSCANRESULTCACHE_H
 #define WLANSCANRESULTCACHE_H
@@ -33,6 +36,7 @@
     TBuf8<KMaxSSIDLength> ssid;
     EConnectionMode networkType;
     WlanSecurityMode securityMode;
+    TUint8 rcpi;
     };
 
 /**
@@ -75,7 +79,7 @@
     
     /**
      * Updates the list of available networks (IAPs and SSIDs)
-     * @param aIapIdList List of available IAPs.
+     * @param aIapAvailabilityList List of available IAPs.
      * @param aNetworkList List of available networks.
      * @param aNewIapsAvailable is set to ETrue on completion if
      *        new networks or IAPs were detected since the last update.
@@ -83,7 +87,7 @@
      *        networks or IAPs have been lost since the last update.
      */
     void UpdateAvailableNetworksList(
-        core_type_list_c<u32_t>& aIapIdList,
+        core_type_list_c<core_iap_availability_data_s>& aIapAvailabilityList,
         RArray<TWlanAvailableNetwork>& aNetworkList,
         TBool& aNewIapsAvailable,
         TBool& aOldIapsLost );
@@ -96,7 +100,7 @@
      * @return Pointer to list of available IAPs or NULL if they are not available
      * or they are too old.
      */
-    RArray<TUint>* AvailableIaps(
+    RArray<TWlmAvailabilityData>* AvailableIaps(
         RArray<TWlanLimitedIapData>& aIapList,
         TUint aCacheLifetime );
 
@@ -144,13 +148,23 @@
         const TWlanAvailableNetwork& aSecond );
 
     /**
+     * Method for determining whether two IAPs are equal.
+     * @param aFirst First IAP.
+     * @param aSecond Second IAP.
+     * @return Result of comparison.
+     */
+    static TBool IsIapEqual(
+        const TWlmAvailabilityData& aFirst,
+        const TWlmAvailabilityData& aSecond );
+
+    /**
      * Check whether the given IAP list is equal with the given IAP data list.
      *
      * @param aIapList IAP list to compare.
      * @param aIapDataList IAP data list to compare against.
      * @return ETrue is the lists are equal, EFalse otherwise.
      */
-    TBool IsIapListEqual(
+    static TBool IsIapListEqual(
         const RArray<TWlanLimitedIapData>& aFirst,
         const RArray<TWlanLimitedIapData>& aSecond );
 
@@ -177,7 +191,7 @@
     RArray<TWlanLimitedIapData> iIapList;
 
     /** Latest list of available IAPs */
-    RArray<TUint> iAvailableIapList;
+    RArray<TWlmAvailabilityData> iAvailableIapList;
 
     /** Latest list of available networks */
     RArray<TWlanAvailableNetwork> iAvailableNetworkList;
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmclientserver.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmclientserver.h	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 42 %
+* %version: 43 %
 */
 
 #ifndef WLMCLIENTSERVER_H
@@ -398,15 +398,24 @@
     };
 
 /**
+ * Data structure for storing IAP availability data.
+ */
+struct TWlmAvailabilityData
+    {
+    TUint iapId;
+    TUint rcpi;
+    };
+
+/**
 * Data structure for storing available IAP IDs.
 */  
 struct TWlmAvailableIaps
     {
     /** The number of IAPs available. */
     TUint32 count;
-    
+
     /** The available IAP IDs. */
-    TFixedArray<TUint,KWlmMaxAvailableIaps> iaps;
+    TFixedArray<TWlmAvailabilityData,KWlmMaxAvailableIaps> iaps;
     };
 
 /**
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmserver.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmserver.h	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 55.1.1 %
+* %version: 55.1.2 %
 */
 
 #ifndef WLMSERVER_H
@@ -94,6 +94,7 @@
             TAny* iParam1;
             TAny* iParam2;
             TAny* iParam3;
+            TAny* iParam4;
             TUint* iTime;
 
             SRequestMapEntry() :
@@ -104,6 +105,7 @@
                 iParam1( NULL ),
                 iParam2( NULL ),
                 iParam3( NULL ),
+                iParam4( NULL ),
                 iTime( NULL )
                 { }
             };
@@ -983,11 +985,11 @@
         	TUint& aTriggeringRequestIndex );        
 
         /**
-        * Notify the server that a background scan has been done.
-        */
+         * Notify the server that a background scan has been done.
+         */
         void NotifyBackgroundScanDone( 
             ScanList* aScanList, 
-            core_type_list_c<u32_t>* aIapIdList );
+            core_type_list_c<core_iap_availability_data_s>& aIapAvailabilityData );
 
         /**
          * Check if this request can be completed.
@@ -1377,7 +1379,22 @@
          * Flag indicating whether aggressive scanning has to be performed
          * after link loss.
          */   
-        TBool iAggressiveScanningAfterLinkLoss;        
+        TBool iAggressiveScanningAfterLinkLoss;
+
+        /**
+         * WLAN device settings. 
+         */
+        CWlanDeviceSettings::SWlanDeviceSettings iDeviceSettings;
+
+        /**
+         * List of "weak" IAP IDs. 
+         */
+        RArray<TUint> iIapWeakList;
+        
+        /**
+         * IAP ID of the connection.
+         */
+        TUint iConnectionIapId;
     };
     
 
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/rwlmserver.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/rwlmserver.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 28 %
+* %version: 28.1.1 %
 */
 
 #include <in_sock.h>
@@ -366,16 +366,17 @@
 EXPORT_C TInt RWLMServer::GetAvailableIaps(
     TWlmAvailableIaps& aAvailableIaps,
     TInt& aCacheLifetime,
-    TUint& aMaxDelay )
+    TUint& aMaxDelay,
+    TBool aFilteredResults )
     {
-    DEBUG2( "RWLMServer::GetAvailableIaps( aAvailableIaps, aCacheLifetime(%d), aMaxDelay(%u) )",
-            aCacheLifetime, aMaxDelay );
+    DEBUG3( "RWLMServer::GetAvailableIaps( aAvailableIaps, aCacheLifetime(%d), aMaxDelay(%u), aFilteredResult(%u) )",
+        aCacheLifetime, aMaxDelay, aFilteredResults );
 
     TRequestStatus status;
     TPckg<TWlmAvailableIaps> inPckg( aAvailableIaps );
     TPckg<TInt> inPckg2( aCacheLifetime );
     TPckg<TUint> inPckg3( aMaxDelay );
-    GetAvailableIaps( inPckg, inPckg2, inPckg3, status );
+    GetAvailableIaps( inPckg, inPckg2, inPckg3, aFilteredResults, status );
     User::WaitForRequest( status );
     DEBUG1( "RWLMServer::GetAvailableIaps() - Server returned status %d", status.Int() );    
 
@@ -389,12 +390,14 @@
     TDes8& aAvailableIaps,
     TDes8& aCacheLifetime,
     TDes8& aMaxDelay,
+    TBool aFilteredResults,
     TRequestStatus& aStatus )
     {
-    DEBUG( "RWLMServer::GetAvailableIaps( aAvailableIaps, aCacheLifetime, aMaxDelay, aStatus )" );
-    
+    DEBUG1( "RWLMServer::GetAvailableIaps( aAvailableIaps, aCacheLifetime, aMaxDelay, aFilteredResult(%u), aStatus )",
+        aFilteredResults );
+
     aStatus = KRequestPending;
-    TIpcArgs params( &aAvailableIaps, &aCacheLifetime, &aMaxDelay );
+    TIpcArgs params( &aAvailableIaps, &aCacheLifetime, &aMaxDelay, aFilteredResults );
     SendReceive( EGetAvailableIaps, params, aStatus );
     }
 
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanconversionutil.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanconversionutil.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,12 +16,12 @@
 */
 
 /*
-* %version: 86 %
+* %version: 86.1.1 %
 */
 
 #include <in_sock.h>
 #include <e32math.h>
-
+#include <in_iface.h>
 #include "wlanconversionutil.h"
 #include "wlmserver.h"
 #include "wlmtsparams.h"
@@ -428,6 +428,8 @@
             return KErrWlanInternalError;
         case core_connect_wapi_certificate_failure:
             return KErrWlanInternalError;
+        case core_connect_ap_unsupported_configuration:
+            return KErrIfAuthenticationFailure;
         default:
             return KErrUnknown;
         }
@@ -1000,6 +1002,7 @@
         case core_error_challenge_failure:
         case core_error_not_connected:
         case core_error_general:
+        case core_error_unsupported_config:
         default:
             return KErrGeneral;
         }
@@ -1031,6 +1034,8 @@
             return core_error_cancel;
         case KErrAlreadyExists:
             return core_error_already_exists;
+        case KWlanErrUnsupportedNwConf:
+            return core_error_unsupported_config;
         default:
             return core_error_general;    
         }
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanmgmtimpl.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanmgmtimpl.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 31 %
+* %version: 31.1.2 %
 */
 
 // INCLUDE FILES
@@ -401,14 +401,14 @@
     iCacheLifetime = KWlanMgmtDefaultCacheLifetime;
     iMaxDelay = KWlanMgmtDefaultMaxDelay;
 
-	TInt ret = iServer.GetAvailableIaps( iaps, iCacheLifetime, iMaxDelay );
+	TInt ret = iServer.GetAvailableIaps( iaps, iCacheLifetime, iMaxDelay, ETrue );
 	if ( ret != KErrNone )
 		{
 		return ret;
 		}   
     for ( TUint idx( 0 ); idx < iaps.count; ++idx )
         {
-        aAvailableIaps.Append( iaps.iaps[idx] );
+        aAvailableIaps.Append( iaps.iaps[idx].iapId );
         }
 
     return KErrNone;
@@ -683,7 +683,7 @@
 //
 void CWlanMgmtImpl::ActivateExtendedNotificationsL(
     MWlanMgmtNotifications& aCallback,
-    TUint aCallbackInterfaceVersion = KWlanCallbackInterfaceVersion )
+    TUint aCallbackInterfaceVersion )
     {
     TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::ActivateExtendedNotificationsL()" ) ) );
     iClientNotification = &aCallback;
@@ -798,6 +798,33 @@
     }
 
 // ---------------------------------------------------------
+// CWlanMgmtImpl::GetAvailableIaps
+// ---------------------------------------------------------
+//
+void CWlanMgmtImpl::GetAvailableIaps(
+    TInt& aCacheLifetime,
+    TUint& aMaxDelay,
+    TBool aFilteredResults,
+    TRequestStatus& aStatus,
+    RArray<TWlanIapAvailabilityData>& aAvailableIaps )
+    {
+    TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetAvailableIaps() (async)" ) ) );
+    
+    aAvailableIaps.Reset();
+    
+    aStatus = KRequestPending;
+    iPendingAvailableIapsStatus = &aStatus;    
+    iAvailableIapsRequest = new CWlanAvailableIapsRequest( *this, iServer, aAvailableIaps, aCacheLifetime, aMaxDelay, aFilteredResults );
+    if ( !iAvailableIapsRequest )
+        {
+        User::RequestComplete( iPendingAvailableIapsStatus, KErrNoMemory );
+        iPendingAvailableIapsStatus = NULL;
+        return;
+        }
+    iAvailableIapsRequest->IssueRequest();
+    }
+
+// ---------------------------------------------------------
 // CWlanMgmtImpl::ScanComplete
 // ---------------------------------------------------------
 //
@@ -1068,10 +1095,36 @@
     CActive( CActive::EPriorityStandard ),
     iCallback( aCallback ),
     iServer( aServer ),
-    iPendingAvailableIaps( aAvailableIaps ),
+    iPendingAvailableIapIds( &aAvailableIaps ),
+    iPendingAvailableIaps( NULL ),
     iAvailableIapsBuf( iAvailableIaps ),
     iCacheLifetimeBuf( aCacheLifetime ),
-    iMaxDelayBuf( aMaxDelay )
+    iMaxDelayBuf( aMaxDelay ),
+    iFilteredResults( ETrue )
+    {
+    TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::CWlanAvailableIapsRequest()" ) ) );
+    CActiveScheduler::Add( this );
+    }
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CWlanAvailableIapsRequest::CWlanAvailableIapsRequest(
+    CWlanMgmtImpl& aCallback, 
+    RWLMServer& aServer,
+    RArray<TWlanIapAvailabilityData>& aAvailableIaps,
+    TInt& aCacheLifetime,
+    TUint& aMaxDelay,
+    TBool aFilteredResults ) :
+    CActive( CActive::EPriorityStandard ),
+    iCallback( aCallback ),
+    iServer( aServer ),
+    iPendingAvailableIapIds( NULL ),
+    iPendingAvailableIaps( &aAvailableIaps ),
+    iAvailableIapsBuf( iAvailableIaps ),
+    iCacheLifetimeBuf( aCacheLifetime ),
+    iMaxDelayBuf( aMaxDelay ),
+    iFilteredResults( aFilteredResults )
     {
     TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::CWlanAvailableIapsRequest()" ) ) );
     CActiveScheduler::Add( this );
@@ -1082,6 +1135,8 @@
     {
     TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::CWlanAvailableIapsRequest()" ) ) );
     Cancel();
+    iPendingAvailableIapIds = NULL;
+    iPendingAvailableIaps = NULL;
     }
 
 // ---------------------------------------------------------
@@ -1091,7 +1146,7 @@
 void CWlanAvailableIapsRequest::IssueRequest()
     {
     TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::IssueRequest()" ) ) );
-    iServer.GetAvailableIaps( iAvailableIapsBuf, iCacheLifetimeBuf, iMaxDelayBuf, iStatus );
+    iServer.GetAvailableIaps( iAvailableIapsBuf, iCacheLifetimeBuf, iMaxDelayBuf, iFilteredResults, iStatus );
     SetActive();
     }
 
@@ -1102,9 +1157,24 @@
 void CWlanAvailableIapsRequest::RunL()
     {
     TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::RunL()" ) ) );
-    for ( TUint idx( 0 ); idx < iAvailableIaps.count; ++idx )
+    if( iPendingAvailableIapIds )
+        {
+        for ( TUint idx( 0 ); idx < iAvailableIaps.count; ++idx )
+            {
+            iPendingAvailableIapIds->Append( iAvailableIaps.iaps[idx].iapId );
+            }
+        }
+    else if( iPendingAvailableIaps )
         {
-        iPendingAvailableIaps.Append( iAvailableIaps.iaps[idx] );
+        for ( TUint idx( 0 ); idx < iAvailableIaps.count; ++idx )
+            {
+            TWlanIapAvailabilityData tmp;
+            tmp.iIapId = iAvailableIaps.iaps[idx].iapId;
+            // RCPI -> RSSI CONVERSION
+            // Note: conversion may round the result by 0.5 units
+            tmp.iRssi = ( 110 - ( iAvailableIaps.iaps[idx].rcpi / 2 ) ); 
+            iPendingAvailableIaps->Append( tmp );
+            }        
         }
     iCallback.AvailableIapsComplete( iStatus.Int() );
     }
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanscanresultcache.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanscanresultcache.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -15,6 +15,9 @@
 *
 */
 
+/*
+* %version: 13 %
+*/
 
 #include "wlanscanresultcache.h"
 #include "am_debug.h"
@@ -119,7 +122,7 @@
 // -----------------------------------------------------------------------------
 //
 void CWlanScanResultCache::UpdateAvailableNetworksList(
-    core_type_list_c<u32_t>& aIapIdList,
+    core_type_list_c<core_iap_availability_data_s>& aIapAvailabilityList,
     RArray<TWlanAvailableNetwork>& aNetworkList,
     TBool& aNewIapsAvailable,
     TBool& aOldIapsLost )
@@ -127,7 +130,7 @@
     DEBUG( "CWlanScanResultCache::UpdateAvailableNetworksList()" ); 
 
     DEBUG1( "CWlanScanResultCache::UpdateAvailableNetworksList() - %u IAP(s) available",
-        aIapIdList.count() );
+        aIapAvailabilityList.count() );
     DEBUG1( "CWlanScanResultCache::UpdateAvailableNetworksList() - %u IAP(s) previously available",
         iAvailableIapList.Count() ); 
     DEBUG1( "CWlanScanResultCache::UpdateAvailableNetworksList() - %u networks(s) available",
@@ -140,26 +143,27 @@
     const TInt oldNetworkCount( iAvailableNetworkList.Count() );
     aNewIapsAvailable = EFalse;
     aOldIapsLost = EFalse;
-    TIdentityRelation<TWlanAvailableNetwork> isEqual( CWlanScanResultCache::IsNetworkEqual );
+    TIdentityRelation<TWlanAvailableNetwork> isNetworkEqual( CWlanScanResultCache::IsNetworkEqual );
+    TIdentityRelation<TWlmAvailabilityData> isIapEqual( CWlanScanResultCache::IsIapEqual );
 
     // Iterate through previously available IAPs to find lost IAPs.    
     TInt idx( 0 );
     //while( idx < oldIapCount && !aOldIapsLost )
     while( idx < oldIapCount )
         {
-        const TUint32* newId = aIapIdList.first();
+        const core_iap_availability_data_s* newIap = aIapAvailabilityList.first();
 
-        while( newId )
+        while( newIap )
             {
-            if( *newId == iAvailableIapList[idx] )
+            if( newIap->id == iAvailableIapList[idx].iapId )
                 {
                 break;
                 }
 
-            newId = aIapIdList.next();
+            newIap = aIapAvailabilityList.next();
             }
 
-        if( !newId )
+        if( !newIap )
             {
             DEBUG1( "CWlanScanResultCache::UpdateAvailableNetworksList() - old IAP %u has been lost",
                 iAvailableIapList[idx] );
@@ -170,18 +174,21 @@
         }
 
     // Iterate through available IAPs to find new IAPs.    
-    const TUint32* newId = aIapIdList.first();
+    const core_iap_availability_data_s* newIap = aIapAvailabilityList.first();
     //while( newId && !aNewIapsAvailable )
-    while( newId )
+    while( newIap )
         {
-        if ( iAvailableIapList.Find( *newId ) == KErrNotFound )
+        TWlmAvailabilityData tmp;
+        tmp.iapId = newIap->id;
+        tmp.rcpi = newIap->rcpi;
+        if ( iAvailableIapList.Find( tmp, isIapEqual ) == KErrNotFound )
             {
             DEBUG1( "CWlanScanResultCache::UpdateAvailableNetworksList() - new IAP %u has been detected",
-                *newId );
+                newIap->id );
             aNewIapsAvailable = ETrue;
             }
-
-        newId = aIapIdList.next();
+        
+        newIap = aIapAvailabilityList.next();
         }
 
     // Iterate through previously available networks to find lost networks.
@@ -189,7 +196,7 @@
     //while ( idx < oldNetworkCount && !aOldIapsLost )
     while ( idx < oldNetworkCount )
         {
-        if ( aNetworkList.Find( iAvailableNetworkList[idx], isEqual ) == KErrNotFound )
+        if ( aNetworkList.Find( iAvailableNetworkList[idx], isNetworkEqual ) == KErrNotFound )
             {
             DEBUG1S( "CWlanScanResultCache::UpdateAvailableNetworksList() - old network has been lost, SSID ",
                 iAvailableNetworkList[idx].ssid.Length(), iAvailableNetworkList[idx].ssid.Ptr() );
@@ -203,7 +210,7 @@
     //while( idx < newNetworkCount && !aNewIapsAvailable )
     while( idx < newNetworkCount )
         {
-        if ( iAvailableNetworkList.Find( aNetworkList[idx], isEqual ) == KErrNotFound )
+        if ( iAvailableNetworkList.Find( aNetworkList[idx], isNetworkEqual ) == KErrNotFound )
             {
             DEBUG1S( "CWlanScanResultCache::UpdateAvailableNetworksList() - new network has been detected, SSID ",
                 aNetworkList[idx].ssid.Length(), aNetworkList[idx].ssid.Ptr() );            
@@ -217,11 +224,14 @@
     iAvailableNetworkList.Reset();
     iIapListTimeStamp.HomeTime();
         
-    newId = aIapIdList.first();
-    while( newId )
+    newIap = aIapAvailabilityList.first();
+    while( newIap )
         {
-        iAvailableIapList.Append( *newId );
-        newId = aIapIdList.next();
+        TWlmAvailabilityData tmp;
+        tmp.iapId = newIap->id;
+        tmp.rcpi = newIap->rcpi;
+        iAvailableIapList.Append( tmp );
+        newIap = aIapAvailabilityList.next();
         }
         
     idx = 0;
@@ -236,7 +246,7 @@
 // CWlanScanResultCache::AvailableIaps
 // -----------------------------------------------------------------------------
 //
-RArray<TUint>* CWlanScanResultCache::AvailableIaps(
+RArray<TWlmAvailabilityData>* CWlanScanResultCache::AvailableIaps(
     RArray<TWlanLimitedIapData>& aIapList,
     TUint aCacheLifetime )
     {
@@ -392,6 +402,22 @@
     }
 
 // -----------------------------------------------------------------------------
+// CWlanScanResultCache::IsIapEqual
+// -----------------------------------------------------------------------------
+//
+TBool CWlanScanResultCache::IsIapEqual(
+    const TWlmAvailabilityData& aFirst,
+    const TWlmAvailabilityData& aSecond )
+    {
+    if ( aFirst.iapId != aSecond.iapId )
+        {
+        return EFalse;
+        }
+
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
 // CWlanScanResultCache::IsIapListEqual
 // -----------------------------------------------------------------------------
 //
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanticktimer.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanticktimer.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -17,7 +17,7 @@
 */
 
 /*
-* %version: 1 %
+* %version: 2 %
 */
 
 #include "wlanticktimer.h"
@@ -72,6 +72,7 @@
 //
 CWlanTickTimer::~CWlanTickTimer()
     {
+    Cancel();
     iTimer.Close();
     }
 
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmscanrequest.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmscanrequest.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -29,7 +29,7 @@
     {
     DEBUG( "CWlmScanRequest::NewL()" );
 
-    CWlmScanRequest* self = new CWlmScanRequest(
+    CWlmScanRequest* self = new (ELeave) CWlmScanRequest(
         aClient );
     CleanupStack::PushL( self );
     self->ConstructL();
--- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmserver.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmserver.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 105.1.1 %
+* %version: 105.1.3 %
 */
 
 #include <e32def.h>
@@ -207,11 +207,10 @@
     TWlanConversionUtil::ConvertMacAddress( core_mac, mac );
 
     // Get Device Settings
-    CWlanDeviceSettings::SWlanDeviceSettings deviceSettings;
-    GetWlanSettingsL( deviceSettings );
-    SetCachedRegion(deviceSettings.region, deviceSettings.regionTimestamp);    
+    GetWlanSettingsL( iDeviceSettings );
+    SetCachedRegion(iDeviceSettings.region, iDeviceSettings.regionTimestamp);    
     core_device_settings_s coreSettings; // core needs the settings here
-    TWlanConversionUtil::ConvertDeviceSettings( coreSettings, deviceSettings );
+    TWlanConversionUtil::ConvertDeviceSettings( coreSettings, iDeviceSettings );
 
     // Create core server    
     User::LeaveIfNull( iCoreServer = core_server_factory_c::instance(
@@ -221,7 +220,7 @@
         core_mac,
         TWlanConversionUtil::ConvertFeatureFlags(
             iSupportedFeatures,
-            deviceSettings.enabledFeatures ) ) );
+            iDeviceSettings.enabledFeatures ) ) );
     iCoreServer->disable_wlan( KWlanIntCmdDisableWlan );
 
     // Create scan timer
@@ -236,7 +235,7 @@
 
     // Create scan cache
     iCache = CWlanScanResultCache::NewL();
-    iConfiguredCacheLifetime = deviceSettings.scanExpirationTimer;
+    iConfiguredCacheLifetime = iDeviceSettings.scanExpirationTimer;
 
     // Create a callback for asynchronous core requests
     TCallBack callback( HandleCoreAsynchCb, this );
@@ -295,6 +294,7 @@
     // Stop all plugins
     iGenericWlanPlugin.StopPlugins();
 
+    iIapWeakList.Close();
     delete iCoreServer;
     delete iDriverIf;
     iNotificationArray.Close();
@@ -647,7 +647,8 @@
     TInt ret = GetCurrentIapId(
         static_cast<TUint>(lanServiceId), 
         *coreIapData );
-        
+    iConnectionIapId = coreIapData->iap_id;
+
     if (  ret != KErrNone )
         {
         secondarySsidList.Close();
@@ -1210,6 +1211,10 @@
     // Read cacheLifetime and maxDelay arguments
     TPckgBuf<TInt> cacheLifetimePckg( KWlmDefaultScanCacheLifetime );
     TPckgBuf<TUint> maxDelayPckg( 0 );
+    TBool isFiltered(
+        aMessage.Int3() );
+    DEBUG1( "CWlmServer::GetAvailableIaps() - isFiltered: %u",
+        isFiltered );
     if( aMessage.Read( 1, cacheLifetimePckg ) != KErrNone )
         {
         DEBUG( "CWlmServer::GetAvailableIaps() - unable to read lifetime parameter" );
@@ -1241,28 +1246,47 @@
      * See if cached IAP availability information is available.
      */
     RArray<TWlanLimitedIapData> iapList;
-    RArray<TUint>* list = iCache->AvailableIaps(
-                                            iapList,
-                                            ( cacheLifetimePckg() == 0 ? 1 : cacheLifetimePckg() ) );
-    
+    RArray<TWlmAvailabilityData>* list = iCache->AvailableIaps(
+        iapList,
+        ( cacheLifetimePckg() == 0 ? 1 : cacheLifetimePckg() ) );
     // Only complete with valid cache if maxDelay is zero
     if( list && maxDelayPckg() == 0 )
         {
-
-        TWlmAvailableIaps tmp;
-        const TInt listCount(
-            Min( list->Count(), KWlmMaxAvailableIaps ) );
-        
-        DEBUG1( "CWlmServer::GetAvailableIaps() - using cached IAP list, list contains %d IAP(s)", listCount );
-        
-        TInt listIdx( 0 );
-
-        while( listIdx < listCount )
+        TWlmAvailableIaps tmp = { 0 };
+        if( isFiltered )
+            {            
+            DEBUG1( "CWlmServer::GetAvailableIaps() - using filtered cached IAP list, list contains %d IAP(s)",
+                list->Count() );
+
+            for( TInt idx( 0 ); idx < list->Count() && tmp.count < KWlmMaxAvailableIaps; ++idx )
+                {
+                if( (*list)[idx].rcpi >= iDeviceSettings.minRcpiForIapAvailability &&
+                    iIapWeakList.Find( (*list)[idx].iapId ) == KErrNotFound )
+                    {
+                    DEBUG2( "CWlmServer::GetAvailableIaps() - IAP %u is available, RCPI is %u",
+                        (*list)[idx].iapId, (*list)[idx].rcpi );
+                    tmp.iaps[tmp.count++] = (*list)[idx];
+                    }
+                else
+                    {
+                    DEBUG2( "CWlmServer::GetAvailableIaps() - IAP %u filtered, RCPI is %u",
+                        (*list)[idx].iapId, (*list)[idx].rcpi );
+                    }
+                }
+            }
+        else
             {
-            tmp.iaps[ listIdx ] = (*list)[listIdx];
-            ++listIdx;
+            DEBUG1( "CWlmServer::GetAvailableIaps() - using cached IAP list, list contains %d IAP(s)",
+                list->Count() );
+
+            for( TInt idx( 0 ); idx < list->Count() && tmp.count < KWlmMaxAvailableIaps; ++idx )
+                {
+                DEBUG2( "CWlmServer::GetAvailableIaps() - IAP %u is available, RCPI is %u",
+                    (*list)[idx].iapId, (*list)[idx].rcpi );
+                tmp.iaps[tmp.count++] = (*list)[idx];                
+                }
             }
-        tmp.count = listCount;
+
         TPckg<TWlmAvailableIaps> outPckg( tmp );
         aMessage.Write( 0, outPckg );
         aMessage.Complete( KErrNone );
@@ -1317,8 +1341,9 @@
     iapList.Close();
 
     // Create output list
-    core_type_list_c<u32_t>* iapIdList = new core_type_list_c<u32_t>;
-    if( iapIdList == NULL )
+    core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList =
+        new core_type_list_c<core_iap_availability_data_s>;
+    if( iapAvailabilityList == NULL )
         {
         aMessage.Complete( KErrNoMemory );
         delete iapDataList;
@@ -1333,7 +1358,7 @@
         aMessage.Complete( KErrNoMemory );        
         delete iapDataList;
         delete iapSsidList;
-        delete iapIdList;
+        delete iapAvailabilityList;
         return;
         }
 
@@ -1349,7 +1374,7 @@
             aMessage.Complete( KErrNoMemory );
             delete iapDataList;
             delete iapSsidList;
-            delete iapIdList;
+            delete iapAvailabilityList;
             delete scanList;
     
             return;
@@ -1369,9 +1394,10 @@
     mapEntry.iRequestId = iRequestIdCounter++;
     mapEntry.iSessionId = aSessionId;    
     mapEntry.iParam0 = iapDataList;
-    mapEntry.iParam1 = iapIdList;
+    mapEntry.iParam1 = iapAvailabilityList;
     mapEntry.iParam2 = scanList;
     mapEntry.iParam3 = iapSsidList;
+    mapEntry.iParam4 = reinterpret_cast<TAny*>( isFiltered );
     mapEntry.iTime = scanTime;
     iRequestMap.Append( mapEntry );
 
@@ -1497,7 +1523,8 @@
 
         return err;
         }
-        
+    iDeviceSettings = settings;
+
     // Only if startup is complete, inform current settings to BgScan
     if( iIsStartupComplete )
         {
@@ -1632,12 +1659,11 @@
 //
 void CWlmServer::NotifyBackgroundScanDone(
     ScanList* aScanList, 
-    core_type_list_c<u32_t>* aIapIdList )
+    core_type_list_c<core_iap_availability_data_s>& aIapAvailabilityData )
     {
     DEBUG( "CWlmServer::NotifyBackgroundScanDone()" );
     ASSERT( aScanList != NULL );
-    ASSERT( aIapIdList != NULL );
-    
+
     // Unload the drivers immediately to conserve power.
     if( !iPlatform->IsWlanDisabled() &&
         iConnectionState == EWlanStateNotConnected )
@@ -1653,7 +1679,7 @@
     TBool newIaps( EFalse );
     TBool lostIaps( EFalse );
     iCache->UpdateAvailableNetworksList(
-        *aIapIdList,
+        aIapAvailabilityData,
         networkList,
         newIaps,
         lostIaps );
@@ -1800,6 +1826,7 @@
                 case EWlanStateNotConnected:
                     DEBUG( "CWlmServer::notify() - STATE: EWlanStateNotConnected" );
                     iIsRoaming = EFalse;
+                    iConnectionIapId = 0;
 
                     // set icon to "not available"
                     SetIconState( EWlmIconStatusNotAvailable );
@@ -1882,6 +1909,29 @@
         case EWlmNotifyAcTrafficStatusChanged:
             DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficStatusChanged<ind>" );
             break;
+        case EWlmNotifyRcpChanged:
+            DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyRcpChanged<ind>" );
+            if( static_cast<core_rcp_class_e>( data[0] ) == core_rcp_normal )
+                {
+                TInt idx = iIapWeakList.Find( iConnectionIapId );
+                if( idx >= 0 )
+                    {
+                    DEBUG1( "CWlmServer::notify() - removing IAP %u from weak list",
+                        iConnectionIapId );
+                    iIapWeakList.Remove( idx );
+                    }
+                }
+            else
+                {
+                TInt idx = iIapWeakList.Find( iConnectionIapId );
+                if( idx == KErrNotFound )
+                    {
+                    DEBUG1( "CWlmServer::notify() - adding IAP %u to weak list",
+                        iConnectionIapId );
+                    iIapWeakList.Append( iConnectionIapId );                    
+                    }
+                }
+            break;
         default:
             break;
         }
@@ -2607,9 +2657,8 @@
             
             ScanList* scanList = 
                 reinterpret_cast<ScanList*>( aRequest.iParam2 );
-            core_type_list_c<u32_t>* idList = 
-                reinterpret_cast<core_type_list_c<u32_t>*>( aRequest.iParam1 );
-                
+            core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList = 
+                reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( aRequest.iParam1 );
             core_type_list_c<core_iap_data_s>* iapDataList =
                 reinterpret_cast<core_type_list_c<core_iap_data_s>*>( aRequest.iParam0 );
             delete iapDataList;
@@ -2625,7 +2674,7 @@
 
                 if( aStatus == core_error_ok )
                     {
-                    NotifyBackgroundScanDone( scanList, idList );
+                    NotifyBackgroundScanDone( scanList, *iapAvailabilityList );
                     // cache takes the ownership of the scanList
                     scanList = NULL;
                     }
@@ -2637,8 +2686,8 @@
             
             delete scanList;
             scanList = NULL;
-            delete idList;
-            idList = NULL;
+            delete iapAvailabilityList;
+            iapAvailabilityList = NULL;
                         
             break;
             }
@@ -2774,29 +2823,33 @@
             // Create pointers to parameters
             core_type_list_c<core_ssid_entry_s>* iapSsidList;
             ScanList* scanList;
-            core_type_list_c<u32_t>* coreIdList;
+            core_type_list_c<core_iap_availability_data_s>* coreAvailabilityList;
             core_type_list_c<core_iap_data_s>* iapDataList;
+            TBool isFiltered( reinterpret_cast<TBool>( aRequest.iParam4 ) );
+            DEBUG1( "CWlmServer::CompleteExternalRequest() - isFiltered: %u",
+                isFiltered );
 
             iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( aRequest.iParam3 );
             iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( aRequest.iParam0 );
             
             TUint* completedScanTime = reinterpret_cast<TUint*>( aRequest.iTime );
             ScanList* completedScanList = reinterpret_cast<ScanList*>( aRequest.iParam2);
-            core_type_list_c<u32_t>* completedIdList = reinterpret_cast<core_type_list_c<u32_t>*>( aRequest.iParam1 );
+            core_type_list_c<core_iap_availability_data_s>* completedAvailabilityList =
+                reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( aRequest.iParam1 );
             
             if( aTriggerRequest == NULL )
                 {
                 DEBUG( "CWlmServer::CompleteExternalRequest() - GetAvailableIaps request handled by core" );    
 
                 scanList = reinterpret_cast<ScanList*>( aRequest.iParam2);
-                coreIdList = reinterpret_cast<core_type_list_c<u32_t>*>( aRequest.iParam1 );
+                coreAvailabilityList = reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( aRequest.iParam1 );
                 }
             else
                 {
                 DEBUG( "CWlmServer::CompleteExternalRequest() - GetAvailableIaps request not handled by core" );    
                 //Use the results of the triggering request to complete also this other request
                 scanList = reinterpret_cast<ScanList*>( aTriggerRequest->iParam2);
-                coreIdList = reinterpret_cast<core_type_list_c<u32_t>*>( aTriggerRequest->iParam1 );                
+                coreAvailabilityList = reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( aTriggerRequest->iParam1 );                
                 }
 
             delete iapSsidList;
@@ -2816,27 +2869,75 @@
                 if( aTriggerRequest == NULL )
                     {
                     iCache->UpdateAvailableNetworksList(
-                        *coreIdList,
+                        *coreAvailabilityList,
                         networkList,
                         newIaps,
                         lostIaps );
                     }
                 networkList.Close();                
 
-                TWlmAvailableIaps tmp;                
-                TUint32* pInt = coreIdList->first();
-                TInt idx = 0;
-                while( pInt )
+                TWlmAvailableIaps tmp = { 0 };
+                core_iap_availability_data_s* pInt = coreAvailabilityList->first();
+                if( isFiltered )
                     {
-                    DEBUG1( "CWlmServer::CompleteExternalRequest() - IAP %u is available",
-                        *pInt );
-                    tmp.iaps[ idx ] = *pInt;
-                    idx++;
-                    pInt = coreIdList->next();
+                    while( pInt && tmp.count < KWlmMaxAvailableIaps )
+                        {
+                        if( pInt->rcpi < iDeviceSettings.minRcpiForIapAvailability )
+                            {
+                            DEBUG3( "CWlmServer::CompleteExternalRequest() - IAP %u filtered, RCPI is too weak (%u vs %u)",
+                                pInt->id, pInt->rcpi, iDeviceSettings.minRcpiForIapAvailability );
+                            }
+                        else if( iIapWeakList.Find( pInt->id ) != KErrNotFound )
+                            {
+                            if( pInt->rcpi < iDeviceSettings.rcpiTrigger )
+                                {
+                                DEBUG3( "CWlmServer::CompleteExternalRequest() - IAP %u filtered, in weak list and RCPI is too weak (%u vs %u)",
+                                    pInt->id, pInt->rcpi, iDeviceSettings.rcpiTrigger );                            
+                                }
+                            else
+                                {
+                                DEBUG2( "CWlmServer::CompleteExternalRequest() - IAP %u is available, RCPI is %u, removed from weak list",
+                                    pInt->id, pInt->rcpi );
+                                tmp.iaps[tmp.count].iapId = pInt->id;
+                                tmp.iaps[tmp.count++].rcpi = pInt->rcpi;
+                                iIapWeakList.Remove(
+                                    iIapWeakList.Find( pInt->id ) );
+                                }
+                            }
+                        else
+                            {
+                            DEBUG2( "CWlmServer::CompleteExternalRequest() - IAP %u is available, RCPI is %u",
+                                pInt->id, pInt->rcpi );
+                            tmp.iaps[tmp.count].iapId = pInt->id;
+                            tmp.iaps[tmp.count++].rcpi = pInt->rcpi;
+                            }
+                        pInt = coreAvailabilityList->next();
+                        }
                     }
-
-                tmp.count = idx;
-                
+                else
+                    {
+                    while( pInt && tmp.count < KWlmMaxAvailableIaps )
+                        {
+                        if( pInt->rcpi >= iDeviceSettings.rcpiTrigger &&
+                            iIapWeakList.Find( pInt->id ) != KErrNotFound )
+                            {                            
+                            DEBUG2( "CWlmServer::CompleteExternalRequest() - IAP %u is available, RCPI is %u, removed from weak list",
+                                pInt->id, pInt->rcpi );
+                            iIapWeakList.Remove(
+                                iIapWeakList.Find( pInt->id ) );
+                            }
+                        else
+                            {
+                            DEBUG2( "CWlmServer::CompleteExternalRequest() - IAP %u is available, RCPI is %u",
+                                pInt->id, pInt->rcpi );
+                            }
+
+                        tmp.iaps[tmp.count].iapId = pInt->id;
+                        tmp.iaps[tmp.count++].rcpi = pInt->rcpi;
+                        pInt = coreAvailabilityList->next();                        
+                        }
+                    }
+
                 if( IsSessionActive( aRequest ) )
                     {
                     TPckg<TWlmAvailableIaps> outPckg( tmp );
@@ -2844,14 +2945,14 @@
                     }
                 if( aTriggerRequest == NULL )
                     {
-                    DEBUG("CWlmServer::CompleteExternalRequest() - delete iapIdList" );
-                    delete coreIdList;	
+                    DEBUG("CWlmServer::CompleteExternalRequest() - delete coreAvailabilityList" );
+                    delete coreAvailabilityList;	
                     }
                 else
                     {
                     // If this completed request was not the triggering request then there is no need
                     // to cache anything. The triggering request results will be cached.
-                    delete completedIdList;
+                    delete completedAvailabilityList;
                     delete completedScanList;
                     }
 
@@ -2872,14 +2973,14 @@
                 // scan failed due to some reason: not caching anything
                 if( aTriggerRequest == NULL )
                     {
-                    delete coreIdList;
+                    delete coreAvailabilityList;
                     delete scanList;
                     }
                 else
                     {
                     // Delete only the lists of the completed request. Triggering request lists are
                     // deleted later on when that request is actually handled.
-                    delete completedIdList;
+                    delete completedAvailabilityList;
                     delete completedScanList; 
                     }
                 }
@@ -3011,6 +3112,7 @@
             TWlanAvailableNetwork network;
             network.ssid.Copy( ieData, ieLength );
             network.securityMode = info.SecurityMode();
+            network.rcpi = info.RXLevel();
             if( info.OperatingMode() == WlanOperatingModeInfra )
                 {
                 network.networkType = Infrastructure;                
@@ -3020,12 +3122,18 @@
                 network.networkType = Adhoc;
                 }
 
-            if ( aNetworkList.Find( network, isEqual ) == KErrNotFound )
+            TInt idx = aNetworkList.Find( network, isEqual ); 
+            if ( idx == KErrNotFound )
                 {
                 DEBUG1S( "CWlmServer::GetNetworkList() - appending SSID ",
                     ieLength, ieData );
                 aNetworkList.Append( network );
                 }
+            else if( idx >= 0 &&
+                     aNetworkList[idx].rcpi < network.rcpi )
+                {
+                aNetworkList[idx].rcpi = network.rcpi;            
+                }
             }
         }
 
@@ -3418,8 +3526,9 @@
     iapList.Close();
 
     // Create output list
-    core_type_list_c<u32_t>* iapIdList = new core_type_list_c<u32_t>;
-    if( iapIdList == NULL )
+    core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList =
+        new core_type_list_c<core_iap_availability_data_s>;
+    if( iapAvailabilityList == NULL )
         {
         DEBUG( "ERROR: Out of memory" );
         delete iapDataList;
@@ -3434,7 +3543,7 @@
         DEBUG( "CWlmServer::BackgroundScanRequest() - Out of memory when instantiating ScanList" );
         delete iapDataList;
         delete iapSsidList;
-        delete iapIdList;
+        delete iapAvailabilityList;
         return KErrNoMemory;
         }
 
@@ -3446,7 +3555,7 @@
 
         delete iapDataList;
         delete iapSsidList;
-        delete iapIdList;
+        delete iapAvailabilityList;
         delete scanList;
         return KErrNoMemory;
         }
@@ -3457,12 +3566,13 @@
     mapEntry.iRequestId = KWlanIntCmdBackgroundScan;
     mapEntry.iSessionId = 0;
     mapEntry.iParam0 = iapDataList;
-    mapEntry.iParam1 = iapIdList;
+    mapEntry.iParam1 = iapAvailabilityList;
     mapEntry.iParam2 = scanList;
     mapEntry.iParam3 = iapSsidList;
+    mapEntry.iParam4 = reinterpret_cast<TAny*>( EFalse );
     mapEntry.iTime = scanTime;
     iRequestMap.Append( mapEntry );
-    
+
     if( IsOnlyTimedScanRequestInRequestMap( mapEntry ) || *scanTime < iScanSchedulingTimerExpiration )
         {
         // Scan scheduling timer needs to be set again because this request needs the results earlier
@@ -3558,7 +3668,8 @@
         DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - GetAvailableIaps requested" );
 
         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 );
+        core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList =
+            reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( 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 );
         TUint* scanTime =  reinterpret_cast<TUint*>( self->iRequestMap[index].iTime );        
@@ -3579,8 +3690,8 @@
 
             delete iapDataList;
             iapDataList = NULL;
-            delete iapIdList;
-            iapIdList = NULL;
+            delete iapAvailabilityList;
+            iapAvailabilityList = NULL;
             delete scanList;
             scanList = NULL;
             delete iapSsidList;
@@ -3629,14 +3740,15 @@
         // pass request to core
         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<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 );
-        core_type_list_c<u32_t>* iapIdList = reinterpret_cast<core_type_list_c<u32_t>*>( self->iRequestMap[index].iParam1 );
+        core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList =
+            reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( self->iRequestMap[index].iParam1 );
         ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 );
         
         self->iCoreServer->get_available_iaps(
             self->iRequestMap[index].iRequestId,
             isActiveScanAllowed,
             *iapDataList,
-            *iapIdList,
+            *iapAvailabilityList,
             iapSsidList,
             *scanList );
         
@@ -3668,14 +3780,15 @@
         // pass request to core
         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<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 );
-        core_type_list_c<u32_t>* iapIdList = reinterpret_cast<core_type_list_c<u32_t>*>( self->iRequestMap[index].iParam1 );
+        core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList =
+            reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( self->iRequestMap[index].iParam1 );
         ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 );
         
         self->iCoreServer->get_available_iaps(
             self->iRequestMap[index].iRequestId,
             isActiveScanAllowed,
             *iapDataList,
-            *iapIdList,
+            *iapAvailabilityList,
             iapSsidList,
             *scanList );
         
@@ -4077,7 +4190,7 @@
             DEBUG( "CWlmServer::CancelScan() - remove entry from request map" );
             SRequestMapEntry entry = iRequestMap[index];
             delete reinterpret_cast<core_type_list_c<core_iap_data_s>*>( entry.iParam0 );
-            delete reinterpret_cast<core_type_list_c<u32_t>*>( entry.iParam1 );
+            delete reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( entry.iParam1 );
             delete reinterpret_cast<ScanList*>( entry.iParam2);
             delete reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( entry.iParam3 );
             delete reinterpret_cast<TUint*>( entry.iTime );
@@ -4114,7 +4227,7 @@
                 DEBUG( "CWlmServer::CancelScan() - remove entry from request map" );
                 SRequestMapEntry entry = iRequestMap[index];
                 delete reinterpret_cast<core_type_list_c<core_iap_data_s>*>( entry.iParam0 );
-                delete reinterpret_cast<core_type_list_c<u32_t>*>( entry.iParam1 );
+                delete reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( entry.iParam1 );
                 delete reinterpret_cast<ScanList*>( entry.iParam2);
                 delete reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( entry.iParam3 );
                 delete reinterpret_cast<TUint*>( entry.iTime );                
@@ -5016,8 +5129,8 @@
 
     ScanList* scanList =
         reinterpret_cast<ScanList*>( aMapEntry.iParam2 );
-    core_type_list_c<u32_t>* iapIdList = 
-        reinterpret_cast<core_type_list_c<u32_t>*>( aMapEntry.iParam1 );
+    core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList = 
+        reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( aMapEntry.iParam1 );
 
     /**
      * Go through the IAP list and find IAPs that haven't been found
@@ -5026,14 +5139,14 @@
     RArray<TWlanLimitedIapData> attachedIapList;
     CleanupClosePushL( attachedIapList );
     const RArray<TWlanLimitedIapData>& cachedIapList(
-        iCache->CachedIapDataList() );    
-    core_type_list_iterator_c<u32_t> iter( *iapIdList );
+        iCache->CachedIapDataList() );
+    core_type_list_iterator_c<core_iap_availability_data_s> iter( *iapAvailabilityList );    
     for( TInt idx( 0 ); idx < cachedIapList.Count(); ++idx )
         {
         TBool isFound( EFalse );
-        for( u32_t* item = iter.first(); !isFound && item; item = iter.next() )
+        for( core_iap_availability_data_s* item = iter.first(); !isFound && item; item = iter.next() )
             {
-            if( *item == cachedIapList[idx].iapId )
+            if( item->id == cachedIapList[idx].iapId )
                 {                
                 isFound = ETrue;
                 }
@@ -5080,11 +5193,13 @@
             attachedIapList[idx].iapId,
             *ssidList );
         TBool isMatch( EFalse );
+        TUint rcpi( 0 );
         for( TInt iidx( 0 ); !isMatch && iidx < networkList.Count(); ++iidx )
             {
             if( attachedIapList[idx].networkType == networkList[iidx].networkType &&
                 ssidList->IsInList( networkList[iidx].ssid ) )
                 {
+                rcpi = networkList[iidx].rcpi;
                 isMatch = ETrue;
                 }
             }
@@ -5096,10 +5211,16 @@
             /**
              * A match has been found, mark the IAP as available.
              */
-            u32_t* iapId = new (ELeave) u32_t(
-                attachedIapList[idx].iapId );
-            iapIdList->append(
-                iapId );
+            core_iap_availability_data_s* data = new (ELeave) core_iap_availability_data_s;
+            data->id = attachedIapList[idx].iapId;
+            data->rcpi = rcpi;
+            core_error_e ret = iapAvailabilityList->append(
+                data );
+            if( ret != core_error_ok )
+                {
+                delete data;
+                }
+            data = NULL;
             }
         else
             {
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacContextImpl.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacContextImpl.h	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 106 %
+* %version: 107 %
 */
 
 #ifndef WLANCONTEXTIMPL_H
@@ -1310,11 +1310,13 @@
     * @param aQueueId Id of the queue/AC via which the frame will be 
     *                 transmitted
     * @param aEtherType Ethernet type of the frame
+    * @param aDot11FrameType 802.11 frame type
     * @return To which power management mode to change; if any at all
     */
     inline TPowerMgmtModeChange OnFrameTx( 
         WHA::TQueueId aQueueId,
-        TUint16 aEtherType );
+        TUint16 aEtherType,
+        T802Dot11FrameControlTypeMask aDot11FrameType = E802Dot11FrameTypeData );
 
     /** 
     * To be called when accepting an Rx frame
@@ -1333,6 +1335,16 @@
         TDaType aDaType );
                         
     /**
+    * To be called when receiving the PS Mode Error indication
+    * 
+    * Informs Dynamic Power Mode Manager about the indication.
+    * Determines the need to make a power mode transition.
+    *
+    * @return To which power management mode to change; if any at all
+    */
+    inline TPowerMgmtModeChange OnPsModeErrorIndication();
+    
+    /**
     * Sets the dynamic power mode transition algorithm parameters
     *
     * @since S60 3.1
@@ -1415,6 +1427,12 @@
     inline void FreezePwrModeMgmtTrafficOverride();
 
     /**
+    * Restores the Active mode parameters of dynamic power mode management 
+    * back to their WLAN Mgmt Client provided values
+    */
+    inline void RestorePwrModeMgmtParameters();
+
+    /**
     * To be called upon Active to Light PS timer timeout
     *
     * @since S60 v5.1
@@ -1760,7 +1778,15 @@
     *
     * @since S60 3.2
     */
-    void OnKeepAliveTimerTimeout();    
+    inline void OnKeepAliveTimerTimeout();
+    
+    /** 
+    * Are we currently in Voice over WLAN Call state
+    * 
+    * @return ETrue if we are
+    *         EFalse if we are not
+    */
+    inline TBool InVoiceCallState() const;
     
     /**
      * Insert new RCPI value into the Signal Predictor.
@@ -1804,13 +1830,27 @@
         WHA::TRcpi aRcpiWarnLevel );
 
     /**
-     * Adds a WLAN feature supported by us to the list of those supported
-     * features which are indicated in BSS membership selector
+     * Adds the specified WLAN feature supported by us to the list of those 
+     * supported features which are indicated in BSS membership selector
      *
      * @param aFeature Feature to add
      */
     void AddBssMembershipFeature( T802Dot11BssMembershipSelector aFeature );
-
+    
+    /**
+     * Removes the specified WLAN feature from our list of those supported
+     * features which are indicated in BSS membership selector
+     *
+     * @param aFeature Feature to remove
+     */
+    void RemoveBssMembershipFeature( TUint8 aItem );
+    
+    /**
+     * Clears (i.e. makes empty) our list of features which are indicated 
+     * in BSS membership selector
+     */
+    inline void ClearBssMembershipFeatureList();
+    
     /**
      * Checks if the specified item is a WLAN feature indicated in BSS 
      * membership selector and if it is supported by us
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacContextImpl.inl	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacContextImpl.inl	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 78 %
+* %version: 79 %
 */
 
 #include "umacconnectcontext.h"
@@ -1610,9 +1610,13 @@
 //
 inline TPowerMgmtModeChange WlanContextImpl::OnFrameTx( 
     WHA::TQueueId aQueueId,
-    TUint16 aEtherType )
+    TUint16 aEtherType,
+    T802Dot11FrameControlTypeMask aDot11FrameType )
     {
-    return iDynamicPowerModeCntx.OnFrameTx( aQueueId, aEtherType );
+    return iDynamicPowerModeCntx.OnFrameTx( 
+        aQueueId, 
+        aEtherType, 
+        aDot11FrameType );
     }
 
 // ---------------------------------------------------------------------------
@@ -1636,6 +1640,15 @@
 // 
 // ---------------------------------------------------------------------------
 //
+inline TPowerMgmtModeChange WlanContextImpl::OnPsModeErrorIndication()
+    {
+    return iDynamicPowerModeCntx.OnPsModeErrorIndication();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
 inline void WlanContextImpl::SetPowerModeManagementParameters(
     TUint32 aToLightPsTimeout,
     TUint16 aToLightPsFrameThreshold,
@@ -1693,6 +1706,15 @@
 // 
 // ---------------------------------------------------------------------------
 //
+inline void WlanContextImpl::RestorePwrModeMgmtParameters()
+    {
+    iDynamicPowerModeCntx.RestoreActiveModeParameters();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
 inline TBool WlanContextImpl::OnActiveToLightPsTimerTimeout()
     {
     return iDynamicPowerModeCntx.OnActiveToLightPsTimerTimeout();
@@ -2059,6 +2081,15 @@
 // 
 // ---------------------------------------------------------------------------
 //
+inline TBool WlanContextImpl::InVoiceCallState() const
+    {
+    return iNullSendController.InVoiceCallState();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
 inline TBool WlanContextImpl::InsertNewRcpiIntoPredictor( 
     TInt64 aTimestamp, 
     WHA::TRcpi aRcpi )
@@ -2100,6 +2131,18 @@
         aRcpiWarnLevel );
     }
 
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+inline void WlanContextImpl::ClearBssMembershipFeatureList()
+    {
+    os_memset( 
+        &iOurBssMembershipFeatureArray, 
+        KUnallocated, 
+        sizeof( iOurBssMembershipFeatureArray ) );
+    }
+
 // ---------------------------------------------------------------------------
 // 
 // ---------------------------------------------------------------------------
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11InfrastructureMode.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11InfrastructureMode.h	Mon Jun 21 17:43:00 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: 34 %
+* %version: 35 %
 */
 
 #ifndef WLANDOT11INFRASTRUCTUREMODE_H
@@ -274,14 +274,6 @@
         WHA::TRcpi aRcpi );
 
     /**
-    * Indicates that the WLAN device has detected problems in the power
-    * save mode operation of the AP
-    * 
-    * @param aCtxImpl global statemachine context
-    */
-    virtual void DoPsModeErrorIndication( WlanContextImpl& aCtxImpl );
-    
-    /**
     * Voice Call Entry timer timeout function
     *
     * @since S60 v3.2
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11State.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11State.h	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 58 %
+* %version: 59 %
 */
 
 #ifndef WLANDOT11STATE_H
@@ -314,14 +314,18 @@
 
 
     /**
-    * 
+    * Determines if it is possible to try to connect to the target nw
     *
     * @since S60 3.2
     * @param aCtxImpl statemachine context
-    * @param 
-    * @return ETrue if ...
+    * @param aScanResponseFrameBodyLength Length of the WLAN Mgmt Client 
+    *        provided scan response frame body received from the target nw
+    * @param aScanResponseFrameBody The WLAN Mgmt Client provided scan 
+    *        response frame body received from the target nw
+    * @return KErrNone if it is possible to try to connect to the target nw
+    *         An error code otherwise
     */
-    TBool InitNetworkConnect( 
+    TInt InitNetworkConnect( 
         WlanContextImpl& aCtxImpl,
         TUint16 aScanResponseFrameBodyLength,
         const TUint8* aScanResponseFrameBody ) const;
@@ -697,8 +701,11 @@
 
     static TBool NetworkCapabilityInformationMet( 
         WlanContextImpl& aCtxImpl );
-    static TBool AreSupportedRatesMet( WlanContextImpl& aCtxImpl,
-                                       TBool aCheckAlsoExtendedRates );
+    
+    static TBool AreSupportedRatesMet( 
+        WlanContextImpl& aCtxImpl,
+        TBool aCheckAlsoExtendedRates );
+    
     static TBool ProcessSingleSupportedRateElement(
         WlanContextImpl& aCtxImpl,
         const TUint8 aApRate,
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Synchronize.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Synchronize.h	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 19 %
+* %version: 20 %
 */
 
 #ifndef WLANDOT11SYNCHRONIZE_H
@@ -105,8 +105,7 @@
         WlanContextImpl& aCtxImpl, 
         TState aNewState );
 
-    TBool InitActions( 
-        WlanContextImpl& aCtxImpl );
+    TInt InitActions( WlanContextImpl& aCtxImpl ) const;
     
     void SetDot11SlotTime( 
         WlanContextImpl& aCtxImpl );
@@ -209,8 +208,8 @@
     
     TState              iState;
 
-    // true, if the Join operation failed
-    TBool iJoinFailed;
+    /** status of the Join operation */
+    TInt iJoinStatus;
 
 #ifndef NDEBUG
     // max length of state name for tracing
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umac_types.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umac_types.h	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 29 %
+* %version: 30 %
 */
 
 #ifndef UMACTYPES_H
@@ -56,7 +56,9 @@
     EPsModeError
     } TIndication;
 
-
+/** Connect failed because of unsupported network configuration */
+const TInt KWlanErrUnsupportedNwConf = -333001;
+    
 /**
 * Maximum length of an SSID in BYTES
 */
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacactivemodepowermodemgr.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacactivemodepowermodemgr.h	Mon Jun 21 17:43:00 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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: 9 %
+* %version: 10 %
 */
 
 #ifndef WLAN_ACTIVE_MODE_POWER_MODE_MGR
@@ -26,13 +26,22 @@
 
 class WlanContextImpl;
 
+
 /**
 * Class implementing infrastructure mode dynamic power mode management 
 * algorithm for Active mode (CAM)
 */
 class WlanActiveModePowerModeMgr : public WlanPowerModeMgrBase
-    {    
-
+    {
+    
+public:
+    /** 
+    * Default Rx/Tx frame count threshold for considering change to Light 
+    * PS mode.
+    * This value is used if another value hasn't been provided
+    */
+    static const TUint KDefaultToLightPsFrameThreshold = 1;
+    
 public:
     
     /** Ctor */
@@ -62,6 +71,7 @@
     * @param aCtxImpl global statemachine context
     * @param aQueueId Id of the queue/AC via which the frame will be transmitted
     * @param aEtherType Ethernet type of the frame
+    * @param aDot11FrameType 802.11 frame type
     * @param aIgnoreThisFrame shall this frame be ignored from dynamic power 
     *                         mode management perspective
     * @return To which power management mode to change; if any at all
@@ -70,6 +80,7 @@
         WlanContextImpl& aCtxImpl, 
         WHA::TQueueId aQueueId,
         TUint16 aEtherType,
+        T802Dot11FrameControlTypeMask aDot11FrameType,
         TBool aIgnoreThisFrame );
 
     /** 
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacactivemodepowermodemgr.inl	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacactivemodepowermodemgr.inl	Mon Jun 21 17:43:00 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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: 4 %
+* %version: 5 %
 */
 
 // -----------------------------------------------------------------------------
@@ -27,6 +27,15 @@
     TUint aToLightPsFrameThreshold,
     TUint16 aUapsdRxFrameLengthThreshold )
     {
+    OsTracePrint( KPwrStateTransition, (TUint8*)
+        ("UMAC: WlanActiveModePowerModeMgr::SetParameters: "
+         "aToLightPsFrameThreshold: %d"),
+        aToLightPsFrameThreshold );
+    OsTracePrint( KPwrStateTransition, (TUint8*)
+        ("UMAC: WlanActiveModePowerModeMgr::SetParameters: "
+         "aUapsdRxFrameLengthThreshold: %d"),
+        aUapsdRxFrameLengthThreshold );
+
     iToLightPsFrameThreshold = aToLightPsFrameThreshold;
     iUapsdRxFrameLengthThreshold = aUapsdRxFrameLengthThreshold;    
     }
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdeeppsmodepowermodemgr.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdeeppsmodepowermodemgr.h	Mon Jun 21 17:43:00 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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_DEEP_PS_MODE_POWER_MODE_MGR
@@ -42,6 +42,14 @@
     virtual ~WlanDeepPsModePowerModeMgr();
     
     /**
+    * Sets the dynamic power mode transition algorithm parameters
+    *
+    * @param aUapsdRxFrameLengthThreshold received frame 
+    *        payload length (in bytes) threshold in U-APSD network
+    */
+    void SetParameters( TUint16 aUapsdRxFrameLengthThreshold );
+    
+    /**
     * To be called when transmitting a frame
     *
     * @since S60 5.1
@@ -49,6 +57,7 @@
     * @param aCtxImpl global statemachine context
     * @param aQueueId Id of the queue/AC via which the frame will be transmitted
     * @param aEtherType Ethernet type of the frame
+    * @param aDot11FrameType 802.11 frame type
     * @param aIgnoreThisFrame shall this frame be ignored from dynamic power 
     *                         mode management perspective
     * @return To which power management mode to change; if any at all
@@ -57,6 +66,7 @@
         WlanContextImpl& aCtxImpl, 
         WHA::TQueueId aQueueId,
         TUint16 aEtherType,
+        T802Dot11FrameControlTypeMask aDot11FrameType,
         TBool aIgnoreThisFrame );
 
     /** 
@@ -80,6 +90,15 @@
         TUint aPayloadLength,
         TDaType aDaType );
     
+    /**
+    * From WlanPowerModeMgrBase
+    * To be called upon receiving the PS Mode Error indication
+    * Determines the need to make a power mode transition
+    *
+    * @return To which power management mode to change; if any at all
+    */
+    virtual TPowerMgmtModeChange OnPsModeErrorIndication();
+    
     /** 
     * From WlanPowerModeMgrBase
     * Resets the state of the object 
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11infrastructurenormalmode.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11infrastructurenormalmode.h	Mon Jun 21 17:43:00 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: 10 %
+* %version: 11 %
 */
 
 #ifndef C_WLANDOT11INFRASTRUCTURENORMALMODE_H
@@ -54,6 +54,16 @@
         WlanContextImpl& aCtxImpl );  
         
     /**
+    * Indicates that the WLAN device has detected problems in the power
+    * save mode operation of the AP
+    * 
+    * @param aCtxImpl global statemachine context
+    * @return ETrue if a state change occurred in the state machine
+    *         EFalse otherwise
+    */
+    virtual void DoPsModeErrorIndication( WlanContextImpl& aCtxImpl );
+    
+    /**
     * Active to Light PS timer timeout function
     *
     * @since S60 v5.1
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdynamicpowermodemgmtcntx.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdynamicpowermodemgmtcntx.h	Mon Jun 21 17:43:00 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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: 12 %
+* %version: 14 %
 */
 
 #ifndef WLAN_DYNAMIC_POWER_MODE_MGMT_CNTX
@@ -66,11 +66,13 @@
     * @since S60 3.1
     * @param aQueueId Id of the queue/AC via which the frame will be transmitted
     * @param aEtherType Ethernet type of the frame
+    * @param aDot11FrameType 802.11 frame type
     * @return To which power management mode to change; if any at all
     */
     TPowerMgmtModeChange OnFrameTx( 
         WHA::TQueueId aQueueId, 
-        TUint16 aEtherType );
+        TUint16 aEtherType,
+        T802Dot11FrameControlTypeMask aDot11FrameType );
 
     /** 
     * To be called when accepting an Rx frame
@@ -89,6 +91,14 @@
         TDaType aDaType );
                         
     /**
+    * To be called upon receiving the PS Mode Error indication
+    * Determines the need to make a power mode transition
+    *
+    * @return To which power management mode to change; if any at all
+    */
+    TPowerMgmtModeChange OnPsModeErrorIndication();
+    
+    /**
     * To be called upon Active to Light PS timer timeout
     *
     * @since S60 v5.1
@@ -194,6 +204,12 @@
     */
     void FreezeTrafficOverride();
 
+    /**
+    * Restores the Active mode parameters back to their WLAN Mgmt Client 
+    * provided values
+    */
+    inline void RestoreActiveModeParameters();
+    
 private:
     
     /** 
@@ -322,7 +338,25 @@
     * @return ETrue if Background AC traffic shall be ignored
     */
     inline TBool StayInPsDespiteLegacyBackgroundTraffic() const;
-        
+    
+    /** 
+    * Sets special parameters for the Active mode.
+    * To be used when switching to Active upen receiving PsModeError 
+    * indication from WHA layer.
+    * The Wlan Mgmt Client provided Active mode parameters can be restored
+    * with RestoreActiveModeParameters()
+    */
+    inline void SetPsModeErrorActiveModeParameters();
+
+    /** 
+    * Sets special parameters for the Active mode.
+    * To be used when switching to Active upon transmitting our keep alive 
+    * frame or an ARP frame.
+    * The Wlan Mgmt Client provided Active mode parameters can be restored
+    * with RestoreActiveModeParameters()
+    */
+    inline void SetKeepAliveActiveModeParameters();
+    
     // Prohibit copy constructor
     WlanDynamicPowerModeMgmtCntx( 
         const WlanDynamicPowerModeMgmtCntx& );
@@ -331,7 +365,15 @@
         ( const WlanDynamicPowerModeMgmtCntx& );
 
 private:    // Data
-        
+
+    /** for backing up the parameters related to Active mode */
+    struct SActiveParamsBackup
+        {
+        TUint32 iToLightPsTimeout;
+        TUint16 iToLightPsFrameThreshold;
+        TUint16 iUapsdRxFrameLengthThreshold;
+        };
+    
     /** flag value to store state transition need internally */
     TBool                       iStateChange; 
     /** stores the flags defined below */
@@ -383,18 +425,27 @@
     /** ToDeepPsTimer started */
     static const TUint32 KToDeepPsTimerStarted = ( 1 << 10 );
     
-    // time interval in microseconds after which transition from Active
-    // mode to Light PS mode is considered. 
+    /** 
+    * time interval in microseconds after which transition from Active
+    * mode to Light PS mode is considered.
+    */ 
     TUint32 iToLightPsTimeout;
 
-    // time interval in microseconds after which the frame counter
-    // used when considering transition from Light PS to Active mode is reset.
+    /**
+    * time interval in microseconds after which the frame counter
+    * used when considering transition from Light PS to Active mode is reset.
+    */
     TUint32 iToActiveTimeout;
 
-    // time interval in microseconds after which transition from Light PS
-    // mode to Deep PS mode is considered. 
+    /**
+    * time interval in microseconds after which transition from Light PS
+    * mode to Deep PS mode is considered.
+    */ 
     TUint32 iToDeepPsTimeout;
-
+    
+    /** for backing up the parameters related to Active mode */
+    SActiveParamsBackup iActiveParamsBackup;
+    
     /** currently active power management mode context */
     WlanPowerModeMgrBase*       iActiveCntx;
     /** context for active mode */
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdynamicpowermodemgmtcntx.inl	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdynamicpowermodemgmtcntx.inl	Mon Jun 21 17:43:00 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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,9 +16,21 @@
 */
 
 /*
-* %version: 5 %
+* %version: 6 %
 */
 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+inline void WlanDynamicPowerModeMgmtCntx::RestoreActiveModeParameters()
+    {
+    iToLightPsTimeout = iActiveParamsBackup.iToLightPsTimeout;
+    iActiveModeCntx.SetParameters( 
+        iActiveParamsBackup.iToLightPsFrameThreshold, 
+        iActiveParamsBackup.iUapsdRxFrameLengthThreshold );
+    }
+
 // -----------------------------------------------------------------------------
 // 
 // -----------------------------------------------------------------------------
@@ -109,3 +121,37 @@
     {    
     return ( iFlags & KStayInPsDespiteLegacyBackgroundTraffic );
     }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+inline void WlanDynamicPowerModeMgmtCntx::SetPsModeErrorActiveModeParameters()
+    {
+    const TUint32 KToLightPsTimeout( 1000000 ); // 1 second
+    const TUint16 KToLightPsFrameThreshold( 4 );
+    const TUint16 KUapsdRxFrameLengthThreshold(
+        WlanPowerModeMgrBase::KDefaultUapsdRxFrameLengthThreshold );
+    
+    iToLightPsTimeout = KToLightPsTimeout;
+    iActiveModeCntx.SetParameters( 
+        KToLightPsFrameThreshold, 
+        KUapsdRxFrameLengthThreshold );
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+inline void WlanDynamicPowerModeMgmtCntx::SetKeepAliveActiveModeParameters()
+    {
+    const TUint32 KToLightPsTimeout( 20000 ); // 20ms
+    const TUint16 KToLightPsFrameThreshold( 1 );
+    const TUint16 KUapsdRxFrameLengthThreshold(
+        WlanPowerModeMgrBase::KDefaultUapsdRxFrameLengthThreshold );
+    
+    iToLightPsTimeout = KToLightPsTimeout;
+    iActiveModeCntx.SetParameters( 
+        KToLightPsFrameThreshold, 
+        KUapsdRxFrameLengthThreshold );
+    }
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaclightpsmodepowermodemgr.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaclightpsmodepowermodemgr.h	Mon Jun 21 17:43:00 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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_LIGHT_PS_MODE_POWER_MODE_MGR
@@ -65,6 +65,7 @@
     * @param aCtxImpl global statemachine context
     * @param aQueueId Id of the queue/AC via which the frame will be transmitted
     * @param aEtherType Ethernet type of the frame
+    * @param aDot11FrameType 802.11 frame type
     * @param aIgnoreThisFrame shall this frame be ignored from dynamic power 
     *                         mode management perspective
     * @return To which power management mode to change; if any at all
@@ -73,6 +74,7 @@
         WlanContextImpl& aCtxImpl, 
         WHA::TQueueId aQueueId,
         TUint16 aEtherType,
+        T802Dot11FrameControlTypeMask aDot11FrameType,
         TBool aIgnoreThisFrame );
 
     /** 
@@ -98,6 +100,15 @@
     
     /**
     * From WlanPowerModeMgrBase
+    * To be called upon receiving the PS Mode Error indication
+    * Determines the need to make a power mode transition
+    *
+    * @return To which power management mode to change; if any at all
+    */
+    virtual TPowerMgmtModeChange OnPsModeErrorIndication();
+    
+    /**
+    * From WlanPowerModeMgrBase
     * To be called upon Light PS to Active timer timeout
     *
     * @since S60 5.1
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacnullsendcontroller.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacnullsendcontroller.h	Mon Jun 21 17:43:00 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: 14 %
+* %version: 15 %
 */
 
 #ifndef WLAN_NULL_SEND_CONTROLLER
@@ -172,6 +172,14 @@
     * @since S60 3.2
     */
     void OnKeepAliveTimerTimeout();
+    
+    /** 
+    * Are we currently in Voice over WLAN Call state
+    * 
+    * @return ETrue if we are
+    *         EFalse if we are not
+    */
+    inline TBool InVoiceCallState() const;
 
 private:
     
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacnullsendcontroller.inl	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacnullsendcontroller.inl	Mon Jun 21 17:43:00 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"
@@ -17,7 +17,7 @@
 */
 
 /*
-* %version: 10 %
+* %version: 11 %
 */
 
 // Default Voice Call Entry timeout
@@ -38,7 +38,7 @@
 
 // Default Keep Alive timeout
 // This value is used if no other value has been provided
-const TUint32 KDefaultKeepAliveTimeout = 200000000; // 200 s
+const TUint32 KDefaultKeepAliveTimeout = 60000000; // 60 s
 
 // Default value for frame payload length threashold of a potential 
 // carrier of downlink Voice over WLAN Call data, which is erroneously 
@@ -221,3 +221,12 @@
         // during a Voice Call
         }
     }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+inline TBool WlanNullSendController::InVoiceCallState() const
+    {
+    return static_cast<TBool>(iFlags & KInVoiceCallState);
+    }
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacpowermodemgrbase.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacpowermodemgrbase.h	Mon Jun 21 17:43:00 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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: 12 %
+* %version: 13 %
 */
 
 #ifndef WLAN_POWER_MODE_MGR_BASE_H
@@ -32,6 +32,7 @@
 
 class WlanContextImpl;
 
+
 /**
 * Common base class for classes implementing dynamic power mode transition 
 * algorithm between PS and active mode in infrastructure mode 
@@ -39,6 +40,10 @@
 class WlanPowerModeMgrBase
     {
 public:
+    // Default frame payload length threshold value (in bytes) for U-APSD
+    static const TUint32 KDefaultUapsdRxFrameLengthThreshold = 400;
+
+public:
 
     /** Dtor */
     virtual ~WlanPowerModeMgrBase();
@@ -51,6 +56,7 @@
     * @param aCtxImpl global statemachine context
     * @param aQueueId Id of the queue/AC via which the frame will be transmitted
     * @param aEtherType Ethernet type of the frame
+    * @param aDot11FrameType 802.11 frame type
     * @param aIgnoreThisFrame shall this frame be ignored from dynamic power 
     *                         mode management perspective
     * @return To which power management mode to change; if any at all
@@ -59,6 +65,7 @@
         WlanContextImpl& aCtxImpl, 
         WHA::TQueueId aQueueId,
         TUint16 aEtherType,
+        T802Dot11FrameControlTypeMask aDot11FrameType,
         TBool aIgnoreThisFrame ) = 0;
 
     /** 
@@ -83,6 +90,14 @@
         TDaType aDaType ) = 0;
 
     /**
+    * To be called upon receiving the PS Mode Error indication
+    * Determines the need to make a power mode transition
+    *
+    * @return To which power management mode to change; if any at all
+    */
+    virtual TPowerMgmtModeChange OnPsModeErrorIndication();
+    
+    /**
     * To be called upon Active to Light PS timer timeout
     *
     * @since S60 v5.1
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacContextImpl.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacContextImpl.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 72 %
+* %version: 73 %
 */
 
 #include "config.h"
@@ -104,10 +104,7 @@
 
     os_memset( &iWHASettings, 0, sizeof( iWHASettings ) );
 
-    os_memset( 
-        &iOurBssMembershipFeatureArray, 
-        KUnallocated, 
-        sizeof( iOurBssMembershipFeatureArray ) );
+    ClearBssMembershipFeatureList();
 
     os_memset( 
         &iHtBlockAckConfigure, 
@@ -1770,6 +1767,34 @@
 // 
 // -----------------------------------------------------------------------------
 //
+void WlanContextImpl::RemoveBssMembershipFeature( TUint8 aItem )
+    {
+    TUint8 i ( 0 );
+
+    do
+        {
+        if ( aItem == iOurBssMembershipFeatureArray[i] )
+            {
+            iOurBssMembershipFeatureArray[i] = KUnallocated;
+
+            OsTracePrint( KUmacDetails, (TUint8*)
+                ("UMAC: WlanContextImpl::RemoveBssMembershipFeature: "
+                 "feature %d removed"),
+                aItem );
+
+            break;
+            }
+        else
+            {
+            ++i;
+            }
+        } while ( i != KMaxNumOfWlanFeatures );
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
 TBool WlanContextImpl::BssMembershipFeatureSupported( TUint8 aItem ) const
     {
     TBool supported ( EFalse );
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Associated.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Associated.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 96.1.1 %
+* %version: 96.1.2 %
 */
 
 #include "config.h"
@@ -1996,7 +1996,7 @@
         const TPowerMgmtModeChange KPowerMgmtModeChange ( 
             aCtxImpl.OnFrameTx( queue_id, etherType ) );
         
-        // if any change change is needed regarding our power mgmt mode,
+        // if any change is needed regarding our power mgmt mode,
         // proceed with it
         stateChange = PowerMgmtModeChange( aCtxImpl, KPowerMgmtModeChange );        
         }
@@ -2236,7 +2236,7 @@
         
         if ( aPowerMgmtModeChange == EToActive )
             {
-            aCtxImpl.DesiredDot11PwrMgmtMode( WHA::KPsDisable );                
+            aCtxImpl.DesiredDot11PwrMgmtMode( WHA::KPsDisable );
             }
         else if ( aPowerMgmtModeChange == EToLightPs )
             {
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Idle.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Idle.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 42 %
+* %version: 43 %
 */
 
 #include "config.h"
@@ -315,13 +315,14 @@
     aCtxImpl.IeData( aIeData );
     aCtxImpl.IeDataLength( aIeDataLength );
 
+    TInt status(KErrNone);
 
     // check do we meet the requirements for the network
     // and construct necessary objects for establishing the connection
-    if ( InitNetworkConnect( 
+    if ( ( status = InitNetworkConnect( 
             aCtxImpl, 
             aScanResponseFrameBodyLength, 
-            aScanResponseFrameBody ) )
+            aScanResponseFrameBody ) ) == KErrNone )
         {
         // continue
 
@@ -350,7 +351,7 @@
         {
         // abort
         ret = EFalse;
-        OnOidComplete( aCtxImpl, KErrGeneral );
+        OnOidComplete( aCtxImpl, status );
         }
 
     return ret;    
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11InfrastructureMode.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11InfrastructureMode.cpp	Mon Jun 21 17:43:00 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: 63 %
+* %version: 64 %
 */
 
 #include "config.h"
@@ -788,19 +788,6 @@
 // 
 // ---------------------------------------------------------------------------
 //
-void WlanDot11InfrastructureMode::DoPsModeErrorIndication( 
-    WlanContextImpl& aCtxImpl )
-    {
-    OsTracePrint( KWlmIndication, (TUint8*)
-        ("UMAC: WlanDot11InfrastructureMode::DoPsModeErrorIndication") ); 
-    
-    OnInDicationEvent( aCtxImpl, EPsModeError );    
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
 TBool WlanDot11InfrastructureMode::OnVoiceCallEntryTimerTimeout( 
     WlanContextImpl& aCtxImpl )
     {
@@ -925,6 +912,7 @@
     
     TUint32 lengthOfFrame( 0 );
     T802Dot11FrameControlTypeMask frameType( E802Dot11FrameTypeDataNull );
+    WHA::TQueueId queue_id( WHA::ELegacy );
 
     // copy Null Data frame to tx-buffer to correct offset
     // client doesn't need to take care of the tx buffer header space
@@ -972,7 +960,7 @@
             }
 
         // determine Tx queue
-        const WHA::TQueueId queue_id( QueueId( aCtxImpl, start_of_frame ) );
+        queue_id = QueueId( aCtxImpl, start_of_frame );
         
         // send the Null Data frame by pushing it to packet scheduler
         aCtxImpl.PushPacketToPacketScheduler( 
@@ -982,13 +970,24 @@
                 frameType,
                 NULL,
                 EFalse,
-                EFalse );
+                EFalse,
+                ETrue );
         }                
     else
         {
         // we didn't get a Tx buffer so we can't submit a frame send request.
         status = EFalse;
         }
-        
+
+    TUint16 KetherType( 0 ); // N/A in this case
+    // check if we need to change power mgmt mode; no matter whether we 
+    // actually managed to send a frame or not
+    const TPowerMgmtModeChange KPowerMgmtModeChange ( 
+        aCtxImpl.OnFrameTx( queue_id, KetherType, frameType ) );
+    
+    // if any change is needed regarding our power mgmt mode,
+    // proceed with it
+    PowerMgmtModeChange( aCtxImpl, KPowerMgmtModeChange );
+    
     return status;                
     }
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11SoftReset.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11SoftReset.cpp	Mon Jun 21 17:43:00 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: 28 %
+* %version: 29 %
 */
 
 #include "config.h"
@@ -137,6 +137,7 @@
     // we are breaking an existing join so we have to reset some
     // state variables and settings
     aCtxImpl.CurrentDot11PwrMgmtMode( WHA::KPsDisable );
+    aCtxImpl.RestorePwrModeMgmtParameters();
     aCtxImpl.Reassociate( EFalse );
     aCtxImpl.QosEnabled( EFalse );
     aCtxImpl.UapsdEnabled( EFalse );
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11State.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11State.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 86.1.1 %
+* %version: 86.1.3 %
 */
 
 #include "config.h"
@@ -3241,14 +3241,24 @@
 // 
 // -----------------------------------------------------------------------------
 //
-TBool WlanDot11State::InitNetworkConnect( 
+TInt WlanDot11State::InitNetworkConnect( 
     WlanContextImpl& aCtxImpl,
     TUint16 aScanResponseFrameBodyLength,
     const TUint8* aScanResponseFrameBody ) const
     {
     OsTracePrint( KUmacDetails, 
         (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect") );
-
+    
+    // 1st clear our BSS Membership feature list
+    aCtxImpl.ClearBssMembershipFeatureList();
+    
+    if ( aCtxImpl.WHASettings().iCapability & WHA::SSettings::KHtOperation )
+        {
+        // wlanpdd indicates HT support. Record that in our BSS Membership
+        // features
+        aCtxImpl.AddBssMembershipFeature( E802Dot11HtPhy );
+        }
+    
     const SScanResponseFixedFields* scanResponseFixedFields = 
         reinterpret_cast<const SScanResponseFixedFields*>( 
             aScanResponseFrameBody );
@@ -3283,7 +3293,7 @@
         OsTracePrint( KWarningLevel, (TUint8*)
             ("UMAC: WlanDot11State::InitNetworkConnect: WAPI requested but not supported by wlanpdd -> abort") );
         
-        return EFalse;
+        return KErrNotSupported;
         }
         
     //=============================================
@@ -3297,12 +3307,9 @@
         OsTracePrint( KWarningLevel, (TUint8*)
             ("UMAC: WlanDot11State::InitNetworkConnect: network capabilities not met -> abort") );
 
-        return EFalse;
+        return KWlanErrUnsupportedNwConf;
         }
 
-    // network capabilities are met -> proceed
-
-
     // initialize element locator for locating IEs from the scan response 
     // frame body
     WlanElementLocator elementLocator( 
@@ -3312,69 +3319,7 @@
 
     TUint8 elementDatalength( 0 );
     const TUint8* elementData( NULL );
-    
-    //=============================================
-    // do we meet mandatory network rates
-    //=============================================
-
-    // locate supported rates IE
-    if ( elementLocator.InformationElement( 
-        E802Dot11SupportedRatesIE,
-        elementDatalength, 
-        &elementData ) == WlanElementLocator::EWlanLocateOk )
-        {
-        // ...and store it to our context
-        aCtxImpl.GetApSupportedRatesIE().SetIeData( 
-            elementData, 
-            elementDatalength );        
-        }
-    else
-        {
-        OsTracePrint( KWarningLevel, (TUint8*)
-            ("UMAC: WlanDot11State::InitNetworkConnect: supported rates IE not found -> abort") );
-
-        return EFalse;
-        }
-
-    // locate extended supported rates information element
-    if ( elementLocator.InformationElement( 
-        E802Dot11ExtendedRatesIE,
-        elementDatalength, 
-        &elementData ) == WlanElementLocator::EWlanLocateOk )
-        {
-        OsTracePrint( KInfoLevel, (TUint8*)
-            ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE present") );
-
-        // ...and store it to our context
-        aCtxImpl.GetApExtendedSupportedRatesIE().SetIeData( elementData, elementDatalength );
-
-        // check if we meet mandatory rates; in this case check also extended supported rates
-        if ( !AreSupportedRatesMet( aCtxImpl, ETrue ) )
-            {
-            OsTracePrint( KWarningLevel, (TUint8*)
-                ("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") );
-
-            return EFalse;
-            }
-        }
-    else
-        {
-        OsTracePrint( KInfoLevel, (TUint8*)
-            ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE not present") );
-
-        // check if we meet mandatory rates; in this case extended supported rates 
-        // don't need to be checked
-        if ( !AreSupportedRatesMet( aCtxImpl, EFalse ) )
-            {
-            OsTracePrint( KWarningLevel, 
-                (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") );
-
-            return EFalse;
-            }            
-        }
-
-    // mandatory network rates are met -> proceed
-    
+        
     //=============================================
     // determine the channel of the network
     //=============================================
@@ -3393,7 +3338,7 @@
         OsTracePrint( KWarningLevel, (TUint8*)
             ("UMAC: WlanDot11State::InitNetworkConnect: 802Dot11DsParameterSetIE not found -> abort") );
 
-        return EFalse;
+        return KWlanErrUnsupportedNwConf;
         }
 
     //=============================================
@@ -3412,7 +3357,7 @@
         OsTracePrint( KWarningLevel, 
             (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: zero beacon interval -> abort") );
 
-        return EFalse;        
+        return KWlanErrUnsupportedNwConf;
         }
 
     //=============================================
@@ -3522,7 +3467,7 @@
                 OsTracePrint( KWarningLevel, (TUint8*)
                     ("UMAC: WlanDot11State::InitNetworkConnect: Nw's 802.11n requirements not met -> abort") );
         
-                return EFalse;
+                return KWlanErrUnsupportedNwConf;
                 }
             }
         else
@@ -3573,11 +3518,72 @@
         }
 
     //=============================================
+    // do we meet mandatory network rates
+    //=============================================
+
+    // locate supported rates IE
+    if ( elementLocator.InformationElement( 
+        E802Dot11SupportedRatesIE,
+        elementDatalength, 
+        &elementData ) == WlanElementLocator::EWlanLocateOk )
+        {
+        // ...and store it to our context
+        aCtxImpl.GetApSupportedRatesIE().SetIeData( 
+            elementData, 
+            elementDatalength );        
+        }
+    else
+        {
+        OsTracePrint( KWarningLevel, (TUint8*)
+            ("UMAC: WlanDot11State::InitNetworkConnect: supported rates IE not found -> abort") );
+
+        return KWlanErrUnsupportedNwConf;
+        }
+
+    // locate extended supported rates information element
+    if ( elementLocator.InformationElement( 
+        E802Dot11ExtendedRatesIE,
+        elementDatalength, 
+        &elementData ) == WlanElementLocator::EWlanLocateOk )
+        {
+        OsTracePrint( KInfoLevel, (TUint8*)
+            ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE present") );
+
+        // ...and store it to our context
+        aCtxImpl.GetApExtendedSupportedRatesIE().SetIeData( elementData, elementDatalength );
+
+        // check if we meet mandatory rates; in this case check also extended
+        // supported rates
+        if ( !AreSupportedRatesMet( aCtxImpl, ETrue ) )
+            {
+            OsTracePrint( KWarningLevel, (TUint8*)
+                ("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") );
+
+            return KWlanErrUnsupportedNwConf;
+            }
+        }
+    else
+        {
+        OsTracePrint( KInfoLevel, (TUint8*)
+            ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE not present") );
+
+        // check if we meet mandatory rates; in this case extended supported
+        // rates don't need to be checked
+        if ( !AreSupportedRatesMet( aCtxImpl, EFalse ) )
+            {
+            OsTracePrint( KWarningLevel, 
+                (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") );
+
+            return KWlanErrUnsupportedNwConf;
+            }            
+        }
+
+    //=============================================
     // determine U-APSD usage for the ACs/Tx queues
     //=============================================
     DetermineAcUapsdUsage( aCtxImpl );
     
-    return ETrue;
+    return KErrNone;
     }
 
 // -----------------------------------------------------------------------------
@@ -4921,7 +4927,8 @@
         aCtxImpl.HtSupportedByNw( ETrue ); 
 
         OsTracePrint( KInfoLevel, (TUint8*)
-            ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities element present => HT supported by nw") );
+            ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities "
+             "element present") );
         }
     else
         {
@@ -4929,7 +4936,8 @@
         aCtxImpl.HtSupportedByNw( EFalse ); 
         
         OsTracePrint( KInfoLevel, (TUint8*)
-            ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities element not found") );
+            ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities "
+             "element not found => HT not supported") );
         }
     
     return status;
@@ -4959,16 +4967,22 @@
             elementDatalength );
 
         OsTracePrint( KInfoLevel, (TUint8*)
-            ("UMAC: WlanDot11State::HandleHtOperation: element present") );
+            ("UMAC: WlanDot11State::HandleHtOperation: element present. "
+             "HT supported") );
         }
     else
         {
-        // not found even though HT capabilities element is present => 
-        // protocol error
-        status = EFalse;
+        // not found even though HT capabilities element is present. That's a 
+        // protocol error. The only way we can try to cope with that is to 
+        // handle the target nw as a non-HT nw
+        aCtxImpl.HtSupportedByNw( EFalse );
+        // in this case we need to remove HT also from our BSS membership 
+        // feature list
+        aCtxImpl.RemoveBssMembershipFeature( E802Dot11HtPhy );
         
         OsTracePrint( KInfoLevel, (TUint8*)
-            ("UMAC: WlanDot11State::HandleHtOperation: element not found => protocol error") );
+            ("UMAC: WlanDot11State::HandleHtOperation: element not found; "
+             "protocol error => HT disabled ") );
         }
     
     return status;
@@ -4998,6 +5012,9 @@
         // nw supported it. We achieve that by handling the target nw as
         // a non-HT nw
         aCtxImpl.HtSupportedByNw( EFalse );
+        // in this case we need to remove HT also from our BSS membership 
+        // feature list
+        aCtxImpl.RemoveBssMembershipFeature( E802Dot11HtPhy );
         
         OsTracePrint( KInfoLevel, (TUint8*)
             ("UMAC: WlanDot11State::HandleDot11n: TKIP as pairwise cipher "
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Synchronize.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Synchronize.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 29 %
+* %version: 31 %
 */
 
 #include "config.h"
@@ -65,7 +65,7 @@
 // -----------------------------------------------------------------------------
 //
 WlanDot11Synchronize::WlanDot11Synchronize() : 
-    iState( EINIT ), iJoinFailed ( EFalse ) 
+    iState( EINIT ), iJoinStatus ( KErrNone ) 
     {
     }
 
@@ -188,7 +188,7 @@
     switch ( iState )
         {
         case EINIT:            
-            if ( InitActions( aCtxImpl ) )
+            if ( ( iJoinStatus = InitActions( aCtxImpl ) ) == KErrNone )
                 {                
                 // we meet the requirements of the network so we can continue
                 
@@ -214,13 +214,12 @@
             else
                 {
                 // network requirements not met. Take the same action as 
-                // as in the join failed case
+                // in the join failed case
                 
                 OsTracePrint( 
                     KWarningLevel, (TUint8*)
                     ("UMAC: WlanDot11Synchronize::OnStateEntryEvent(): network requirements not met - abort"));            
                 
-                iJoinFailed = ETrue;
                 ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE );
                 }
             break;
@@ -408,11 +407,11 @@
         KUmacDetails, 
         (TUint8*)("UMAC: WlanDot11Synchronize::ContinueDot11StateTraversal()"));
 
-    if ( iJoinFailed )    
+    if ( iJoinStatus != KErrNone )
         {
         // set the completion code value to be returned to user mode
         // as the dot11idle state does the OID completion in this case
-        aCtxImpl.iStates.iIdleState.Set( KErrGeneral );
+        aCtxImpl.iStates.iIdleState.Set( iJoinStatus );
         // ... and proceed to dot11idle state                      
         ChangeState( aCtxImpl, 
             *this,                          // prev state
@@ -468,7 +467,7 @@
 // 
 // -----------------------------------------------------------------------------
 //
-TBool WlanDot11Synchronize::InitActions( WlanContextImpl& aCtxImpl )
+TInt WlanDot11Synchronize::InitActions( WlanContextImpl& aCtxImpl ) const
     {
     OsTracePrint( 
         KUmacDetails, 
@@ -477,7 +476,6 @@
     // as we are about to join a new AP, reset BSS Loss indicators
     aCtxImpl.ResetBssLossIndications();
 
-    iJoinFailed = EFalse;
     // reset counter for this new AP connection
     aCtxImpl.ResetFailedTxPacketCount();            
         
@@ -497,6 +495,9 @@
     // Light PS is the initial desired PS mode configuration
     aCtxImpl.SetDesiredPsModeConfig( 
         aCtxImpl.ClientLightPsModeConfig() );
+    // also make sure that the dynamic power mode managemen parameters are in
+    // their WLAN Mgmt Client provided values
+    aCtxImpl.RestorePwrModeMgmtParameters();
     
     // check do we meet the requirements for the network
     // and construct necessary objects for doing the connection
@@ -504,7 +505,7 @@
     return InitNetworkConnect( 
         aCtxImpl,
         aCtxImpl.ScanResponseFrameBodyLength(),
-        aCtxImpl.ScanResponseFrameBody() );        
+        aCtxImpl.ScanResponseFrameBody() );
     }
 
 // -----------------------------------------------------------------------------
@@ -984,7 +985,7 @@
             // make a note of the failure and act 
             // accordingly when we
             // soon again enter this state
-            iJoinFailed = ETrue;
+            iJoinStatus = KErrGeneral;
             }
         else
             {
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaConfigure.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaConfigure.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2008 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: 23 %
+* %version: 24 %
 */
 
 #include "config.h"
@@ -171,14 +171,7 @@
             ("UMAC: WlanWsaConfigure::Entry: iMcsFeedback: %d"), 
             aCtxImpl.WHASettings().iHtCapabilities.iMcsFeedback );
         }
-#endif
-    
-    if ( aCtxImpl.WHASettings().iCapability & WHA::SSettings::KHtOperation )
-        {
-        // wlanpdd indicates HT support. Record that in our BSS Membership
-        // features
-        aCtxImpl.AddBssMembershipFeature( E802Dot11HtPhy );        
-        }
+#endif    
     }
 
 // -----------------------------------------------------------------------------
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacactivemodepowermodemgr.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacactivemodepowermodemgr.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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: 13 %
+* %version: 14 %
 */
 
 #include "config.h"
@@ -24,11 +24,6 @@
 #include "UmacContextImpl.h"
 
 
-// Default Rx/Tx frame count threshold for considering change to Light PS mode.
-// This value is used if another value hasn't been provided
-const TUint KDefaultToLightPsFrameThreshold = 1;
-
-
 // ================= MEMBER FUNCTIONS =======================
 
 // ---------------------------------------------------------------------------
@@ -57,6 +52,7 @@
     WlanContextImpl& /*aCtxImpl*/, 
     WHA::TQueueId /*aQueueId*/,
     TUint16 aEtherType,
+    T802Dot11FrameControlTypeMask aDot11FrameType,
     TBool aIgnoreThisFrame )
     {
     if ( aEtherType == KEapolType ||
@@ -69,7 +65,7 @@
         }
     else
         {
-        if ( aIgnoreThisFrame )
+        if ( aIgnoreThisFrame || aDot11FrameType == E802Dot11FrameTypeDataNull )
             { 
             // for these frames we don't increment the Tx counter
     
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdeeppsmodepowermodemgr.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdeeppsmodepowermodemgr.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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 %
 */
 
 #include "config.h"
@@ -42,32 +42,53 @@
     {
     }
 
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void WlanDeepPsModePowerModeMgr::SetParameters(
+    TUint16 aUapsdRxFrameLengthThreshold )
+    {
+    iUapsdRxFrameLengthThreshold = aUapsdRxFrameLengthThreshold;
+    }
+
 // ---------------------------------------------------------------------------
 // 
 // ---------------------------------------------------------------------------
 //
 TPowerMgmtModeChange WlanDeepPsModePowerModeMgr::OnFrameTx( 
-    WlanContextImpl& /*aCtxImpl*/, 
+    WlanContextImpl& aCtxImpl, 
     WHA::TQueueId /*aQueueId*/,
     TUint16 aEtherType,
-    TBool /*aIgnoreThisFrame*/ )
+    T802Dot11FrameControlTypeMask aDot11FrameType,
+    TBool aIgnoreThisFrame )
     {
     TPowerMgmtModeChange powerMgmtModeChange( ENoChange );
 
     if ( aEtherType == KEapolType ||
-         aEtherType == KWaiType )
+         aEtherType == KWaiType ||
+         aDot11FrameType == E802Dot11FrameTypeDataNull ||
+         ( aEtherType == KArpType && 
+           !(aCtxImpl.UapsdUsedForVoice() && aCtxImpl.InVoiceCallState()) ) ) 
         {
         powerMgmtModeChange = EToActive;
 
         OsTracePrint( KPwrStateTransition, (TUint8*)
-            ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameTx: EAPOL or WAI frame; change to Active") );            
+            ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameTx: EAPOL, WAI or keep "
+             "alive frame or ARP in non- U-APSD WoWLAN call state; change to "
+			 "Active") );
         }
-    else
+    else if ( !aIgnoreThisFrame )
         {
         powerMgmtModeChange = EToLightPs; 
 
         OsTracePrint( KPwrStateTransition, (TUint8*)
-            ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameTx: change to Light PS") );            
+            ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameTx: change to Light"
+             " PS") );            
+        }
+    else
+        {
+        // no action needed
         }
     
     return powerMgmtModeChange;    
@@ -78,11 +99,11 @@
 // ---------------------------------------------------------------------------
 //
 TPowerMgmtModeChange WlanDeepPsModePowerModeMgr::OnFrameRx( 
-    WlanContextImpl& /*aCtxImpl*/,
-    WHA::TQueueId /*aAccessCategory*/,
+    WlanContextImpl& aCtxImpl,
+    WHA::TQueueId aAccessCategory,
     TUint16 aEtherType,
-    TBool /*aIgnoreThisFrame*/,
-    TUint /*aPayloadLength*/,
+    TBool aIgnoreThisFrame,
+    TUint aPayloadLength,
     TDaType aDaType ) 
     {
     TPowerMgmtModeChange powerMgmtModeChange( ENoChange );
@@ -93,22 +114,36 @@
         powerMgmtModeChange = EToActive;
 
         OsTracePrint( KPwrStateTransition, (TUint8*)
-            ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameRx: EAPOL or WAI frame; change to Active") );            
-        }
-    else if ( aDaType == EBroadcastAddress ) 
-        {
-        // no action needed
-        
-        OsTracePrint( KPwrStateTransition, (TUint8*)
-            ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameRx: bcast frame; no state change") );            
+            ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameRx: EAPOL or WAI frame;"
+             " change to Active") );            
         }
     else
         {
-        powerMgmtModeChange = EToLightPs;        
+        if ( CountThisFrame( 
+                aCtxImpl, 
+                aAccessCategory,
+                aEtherType,
+                aIgnoreThisFrame, 
+                aPayloadLength, 
+                iUapsdRxFrameLengthThreshold,
+                aDaType ) )
+            {
+            powerMgmtModeChange = EToLightPs;        
 
-        OsTracePrint( KPwrStateTransition, (TUint8*)
-            ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameRx: change to Light PS") );            
+            OsTracePrint( KPwrStateTransition, (TUint8*)
+                ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameRx: change to Light"
+                 " PS") );            
+            }
         }
     
-    return powerMgmtModeChange;    
+    return powerMgmtModeChange;
     }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TPowerMgmtModeChange WlanDeepPsModePowerModeMgr::OnPsModeErrorIndication()
+    {
+    return EToActive;
+    }
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11ibssnormalmode.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11ibssnormalmode.cpp	Mon Jun 21 17:43:00 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: 14 %
+* %version: 15 %
 */
 
 #include "config.h"
@@ -110,13 +110,14 @@
     aCtxImpl.IeData( aIeData );
     aCtxImpl.IeDataLength( aIeDataLength );
 
+    TInt status(KErrNone);
 
     // check do we meet the requirements for the network
     // and construct necessary objects for establishing the connection
-    if ( InitNetworkConnect( 
+    if ( ( status = InitNetworkConnect( 
             aCtxImpl,
             aScanResponseFrameBodyLength, 
-            aScanResponseFrameBody ) )
+            aScanResponseFrameBody ) ) == KErrNone )
         {
         // continue
 
@@ -134,7 +135,7 @@
         {
         // abort
         ret = EFalse;
-        OnOidComplete( aCtxImpl, KErrGeneral );
+        OnOidComplete( aCtxImpl, status );
         }
 
     return ret;
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11infrastructurenormalmode.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11infrastructurenormalmode.cpp	Mon Jun 21 17:43:00 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"
@@ -17,7 +17,7 @@
 */
 
 /*
-* %version: 14 %
+* %version: 15 %
 */
 
 #include "config.h"
@@ -56,6 +56,28 @@
 // 
 // ---------------------------------------------------------------------------
 //
+void WlanDot11InfrastructureNormalMode::DoPsModeErrorIndication( 
+    WlanContextImpl& aCtxImpl )
+    {
+    OsTracePrint( KWlmIndication, (TUint8*)
+        ("UMAC: WlanDot11InfrastructureMode::DoPsModeErrorIndication") );
+    
+    // as the lower layers indicate that there is a problem with the PS
+    // operation of the current AP, we want to be in CAM mode for as long
+    // as there's data activity. So, check if we need a mode change to be
+    // in CAM now
+    const TPowerMgmtModeChange KPowerMgmtModeChange ( 
+        aCtxImpl.OnPsModeErrorIndication() );
+    
+    // if any change is needed regarding our power mgmt mode,
+    // proceed with it
+    PowerMgmtModeChange( aCtxImpl, KPowerMgmtModeChange );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
 TBool WlanDot11InfrastructureNormalMode::OnActiveToLightPsTimerTimeout( 
     WlanContextImpl& aCtxImpl )
     {
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdynamicpowermodemgmtcntx.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdynamicpowermodemgmtcntx.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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: 14 %
+* %version: 15 %
 */
 
 #include "config.h"
@@ -55,6 +55,11 @@
     iActiveCntx( NULL ),
     iWlanContextImpl( aWlanCtxImpl ) 
     {
+    iActiveParamsBackup.iToLightPsTimeout = KDefaultToLightPsTimeout;
+    iActiveParamsBackup.iToLightPsFrameThreshold = 
+        WlanActiveModePowerModeMgr::KDefaultToLightPsFrameThreshold;
+    iActiveParamsBackup.iUapsdRxFrameLengthThreshold = 
+        WlanPowerModeMgrBase::KDefaultUapsdRxFrameLengthThreshold;
     os_memset( iIgnoreTraffic, 0, sizeof( iIgnoreTraffic ) );
     }
 
@@ -158,7 +163,8 @@
 //
 TPowerMgmtModeChange WlanDynamicPowerModeMgmtCntx::OnFrameTx( 
     WHA::TQueueId aQueueId,
-    TUint16 aEtherType )
+    TUint16 aEtherType,
+    T802Dot11FrameControlTypeMask aDot11FrameType )
     {
     TPowerMgmtModeChange powerMgmtModeChange( ENoChange );
 
@@ -172,13 +178,23 @@
                 iWlanContextImpl, 
                 aQueueId,
                 aEtherType,
+                aDot11FrameType,
                 iIgnoreTraffic[aQueueId] );
             
             if ( powerMgmtModeChange != ENoChange )
                 {
+                iStateChange = ETrue;
+            
                 // as we will do a mode change, cancel any possibly running 
                 // power mode management timers
                 CancelTimeouts();
+                
+                if ( aDot11FrameType == E802Dot11FrameTypeDataNull ||
+                     aEtherType == KArpType )
+                    {
+                    // modify temporarily the Active mode parameters
+                    SetKeepAliveActiveModeParameters();
+                    }
                 }
             }        
         else
@@ -230,6 +246,8 @@
             
             if ( powerMgmtModeChange != ENoChange )
                 {
+                iStateChange = ETrue;
+            
                 // as we will do a mode change, cancel any possibly running 
                 // power mode management timers
                 CancelTimeouts();
@@ -260,6 +278,57 @@
 // 
 // ---------------------------------------------------------------------------
 //
+TPowerMgmtModeChange WlanDynamicPowerModeMgmtCntx::OnPsModeErrorIndication()
+    {
+    TPowerMgmtModeChange powerMgmtModeChange( ENoChange );
+
+    if ( iActiveCntx )
+        {
+        // we have an active context, i.e. we are doing power mode mgmt
+        
+        if ( !iStateChange )
+            {
+            powerMgmtModeChange = iActiveCntx->OnPsModeErrorIndication();
+            
+            if ( powerMgmtModeChange != ENoChange )
+                {
+                iStateChange = ETrue;
+                
+                // as we will do a mode change, cancel any possibly running 
+                // power mode management timers
+                CancelTimeouts();
+                
+                // modify temporarily the Active mode parameters
+                SetPsModeErrorActiveModeParameters();
+                }
+            }
+        else
+            {
+            // state change already signalled from this power mode context, 
+            // don't do it more than once. No action needed
+            OsTracePrint( KPwrStateTransition, (TUint8*)
+                ("UMAC: WlanDynamicPowerModeMgmtCntx::OnPsModeErrorIndication: "
+                 "statechange already signalled") );
+            }
+        }
+    else
+        {
+        // dynamic power mode mgmt is not active => "No change" will be 
+        // returned. No action needed
+        }
+        
+    OsTracePrint( KPwrStateTransition, (TUint8*)
+        ("UMAC: WlanDynamicPowerModeMgmtCntx::OnPsModeErrorIndication: "
+         "statechange: %d"),
+        powerMgmtModeChange );
+    
+    return powerMgmtModeChange;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
 TBool WlanDynamicPowerModeMgmtCntx::OnActiveToLightPsTimerTimeout()
     {
     if ( ( iActiveCntx == &iActiveModeCntx ) && 
@@ -274,6 +343,11 @@
             ("UMAC: WlanDynamicPowerModeMgmtCntx::OnActiveToLightPsTimerTimeout: change state: %d"),
             iStateChange );
         
+        // make sure that the WLAN Mgmt Client provided Active mode 
+        // parameter values are again used the next time by default
+        //
+        RestoreActiveModeParameters();
+        
         if ( !iStateChange )
             {
             RegisterToLightPsTimeout();
@@ -292,6 +366,11 @@
         // In all these cases the timeout is not relevant and we take no action
         OsTracePrint( KPwrStateTransition, (TUint8*)
             ("UMAC: WlanDynamicPowerModeMgmtCntx::OnActiveToLightPsTimerTimeout: not relevant timeout") );
+        
+        // however, make sure that the WLAN Mgmt Client provided Active mode
+        // parameter values are again used the next time by default
+        //
+        RestoreActiveModeParameters();        
         }
     
     return iStateChange;
@@ -406,6 +485,15 @@
         aToActiveFrameThreshold,
         aToDeepPsFrameThreshold,
         aUapsdRxFrameLengthThreshold );
+    
+    iDeepPsModeCntx.SetParameters( aUapsdRxFrameLengthThreshold );
+    
+    // take also a backup of the Active mode parameters
+    //
+    iActiveParamsBackup.iToLightPsTimeout = aToLightPsTimeout;
+    iActiveParamsBackup.iToLightPsFrameThreshold = aToLightPsFrameThreshold;
+    iActiveParamsBackup.iUapsdRxFrameLengthThreshold = 
+        aUapsdRxFrameLengthThreshold;    
     }
 
 // ---------------------------------------------------------------------------
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/umaclightpsmodepowermodemgr.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umaclightpsmodepowermodemgr.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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 %
 */
 
 #include "config.h"
@@ -59,49 +59,54 @@
 // ---------------------------------------------------------------------------
 //
 TPowerMgmtModeChange WlanLightPsModePowerModeMgr::OnFrameTx( 
-    WlanContextImpl& /*aCtxImpl*/, 
+    WlanContextImpl& aCtxImpl, 
     WHA::TQueueId /*aQueueId*/,
     TUint16 aEtherType,
+    T802Dot11FrameControlTypeMask aDot11FrameType,
     TBool aIgnoreThisFrame )
     {
     TPowerMgmtModeChange powerMgmtModeChange( ENoChange );
 
     if ( aEtherType == KEapolType ||
-         aEtherType == KWaiType )
+         aEtherType == KWaiType ||
+         aDot11FrameType == E802Dot11FrameTypeDataNull ||
+         ( aEtherType == KArpType && 
+           !(aCtxImpl.UapsdUsedForVoice() && aCtxImpl.InVoiceCallState())) )
         {
         powerMgmtModeChange = EToActive;
 
         OsTracePrint( KPwrStateTransition, (TUint8*)
-            ("UMAC: WlanLightPsModePowerModeMgr::OnFrameTx: EAPOL or WAI frame; change to Active") );            
+            ("UMAC: WlanLightPsModePowerModeMgr::OnFrameTx: EAPOL, WAI or keep "
+             "alive frame or ARP in non- U-APSD WoWLAN call state; change to "
+			 "Active") );
+        }
+    else if ( !aIgnoreThisFrame )
+        {
+        OsTracePrint( KPwrStateTransition, (TUint8*)
+            ("UMAC: WlanLightPsModePowerModeMgr::OnFrameTx: count this frame") );
+
+        ++iToActiveFrameCount;
+        ++iToDeepPsFrameCount;
+        
+        if ( iToActiveFrameCount >= iToActiveFrameThreshold )
+            {
+            powerMgmtModeChange = EToActive;
+
+            OsTracePrint( KPwrStateTransition, (TUint8*)
+                ("UMAC: WlanLightPsModePowerModeMgr::OnFrameTx: threshold "
+                 "exceeded; change to Active") );            
+            }
         }
     else
         {
-        if ( !aIgnoreThisFrame )
-            {
-            OsTracePrint( KPwrStateTransition, (TUint8*)
-                ("UMAC: WlanLightPsModePowerModeMgr::OnFrameTx: count this frame") );
-
-            ++iToActiveFrameCount;
-            ++iToDeepPsFrameCount;
-            
-            if ( iToActiveFrameCount >= iToActiveFrameThreshold )
-                {
-                powerMgmtModeChange = EToActive;
-
-                OsTracePrint( KPwrStateTransition, (TUint8*)
-                    ("UMAC: WlanLightPsModePowerModeMgr::OnFrameTx: threshold exceeded; change to Active") );            
-                }
-            }
-        else
-            {
-            OsTracePrint( KPwrStateTransition, (TUint8*)
-                ("UMAC: WlanLightPsModePowerModeMgr::OnFrameTx: do no count this frame") );
-            
-            // no further action needed
-            }
+        OsTracePrint( KPwrStateTransition, (TUint8*)
+            ("UMAC: WlanLightPsModePowerModeMgr::OnFrameTx: do not count "
+             "this frame") );
+        
+        // no action needed
         }
     
-    return powerMgmtModeChange;    
+    return powerMgmtModeChange;
     }
 
 // ---------------------------------------------------------------------------
@@ -157,6 +162,15 @@
 // 
 // ---------------------------------------------------------------------------
 //
+TPowerMgmtModeChange WlanLightPsModePowerModeMgr::OnPsModeErrorIndication()
+    {
+    return EToActive;
+    }
+        
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
 TBool WlanLightPsModePowerModeMgr::OnLightPsToActiveTimerTimeout(
     WlanContextImpl& aCtxImpl )
     {
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacnullsendcontroller.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacnullsendcontroller.cpp	Mon Jun 21 17:43:00 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: 15 %
+* %version: 16 %
 */
 
 #include "config.h"
@@ -397,32 +397,17 @@
     
     iFlags &= ~KKeepAliveTimerArmed;
 
-    TUint32 KTimeAfterLatestTx ( 
-        static_cast<TUint32>(os_systemTime() - iLatestTx) );
-    
-    if ( KTimeAfterLatestTx >= iKeepAliveTimeout )
+    // request a regular Null Data frame to be sent
+    // however, if there is a frame Tx (of any frame) already pending OR
+    // we use U-APSD for Voice and we are on a VoWLAN call
+    // we won't request a new frame to be sent. 
+    if ( !iWlanContextImpl.UnsentTxPackets() &&
+         !( iWlanContextImpl.UapsdUsedForVoice() && InVoiceCallState() ) )
         {
-        // request a regular Null Data frame to be sent
-    
-        // however, if there is a frame Tx (of any frame) already pending, 
-        // we won't request a new frame to be sent. 
-        if ( !iWlanContextImpl.UnsentTxPackets() )
+        if ( !iNullSender.TxNullDataFrame( iWlanContextImpl, EFalse ) )
             {
-            if ( !iNullSender.TxNullDataFrame( iWlanContextImpl, EFalse ) )
-                {
-                // frame was not sent because we didn't get a Tx buffer.
-                // In this case we'll skip the sending
-                // However, we need to re-arm the timer to trigger the next
-                // Null Data frame sending
-                RegisterKeepAliveTimeout( iKeepAliveTimeout );
-                }
-            }
-        else
-            {
-            // frame Tx already pending, so we don't ask a Null Data to be sent
-            OsTracePrint( KUmacDetails, (TUint8*)
-                ("UMAC: WlanNullSendController::OnKeepAliveTimerTimeout: frame Tx already pending. New Null Data Tx request skipped") );
-            
+            // frame was not sent because we didn't get a Tx buffer.
+            // In this case we'll skip the sending
             // However, we need to re-arm the timer to trigger the next
             // Null Data frame sending
             RegisterKeepAliveTimeout( iKeepAliveTimeout );
@@ -430,9 +415,15 @@
         }
     else
         {
-        // No need to send keep alive; yet. Re-arm the timer with 
-        // a suitable timeout relative to the time of the latest frame Tx
-        RegisterKeepAliveTimeout( iKeepAliveTimeout - KTimeAfterLatestTx );        
+        // we don't ask a Null Data to be sent
+        OsTracePrint( KUmacDetails, (TUint8*)
+            ("UMAC: WlanNullSendController::OnKeepAliveTimerTimeout: frame Tx "
+             "already pending OR U-APSD used for Voice and we are in VoWLAN"
+             "call => Null Data Tx request skipped") );
+        
+        // However, we need to re-arm the timer to trigger the next
+        // Null Data frame sending
+        RegisterKeepAliveTimeout( iKeepAliveTimeout );
         }
     }
 
--- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacpowermodemgrbase.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacpowermodemgrbase.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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,16 +16,13 @@
 */
 
 /*
-* %version: 8 %
+* %version: 9 %
 */
 
 #include "config.h"
 #include "umacpowermodemgrbase.h"
 #include "UmacContextImpl.h"
 
-// Default frame payload length threshold value (in bytes) for U-APSD
-const TUint32 KUapsdRxFrameLengthThreshold = 400;
-
 
 // ================= MEMBER FUNCTIONS =======================
 
@@ -34,7 +31,7 @@
 // ---------------------------------------------------------------------------
 //
 WlanPowerModeMgrBase::WlanPowerModeMgrBase() : 
-    iUapsdRxFrameLengthThreshold( KUapsdRxFrameLengthThreshold )
+    iUapsdRxFrameLengthThreshold( KDefaultUapsdRxFrameLengthThreshold )
     {
     }
 
@@ -50,6 +47,15 @@
 // 
 // ---------------------------------------------------------------------------
 //
+TPowerMgmtModeChange WlanPowerModeMgrBase::OnPsModeErrorIndication()
+    {
+    return ENoChange;
+    }
+        
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
 TBool WlanPowerModeMgrBase::OnActiveToLightPsTimerTimeout()
     {
     return EFalse;
--- a/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/RWlanLogicalChannel.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/RWlanLogicalChannel.h	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 18 %
+* %version: 18.1.1 %
 */
 
 #ifndef RWLAN_LOGICAL_CHANNEL_H_
@@ -201,11 +201,6 @@
 private: // data
 
     /**
-     * has the WLAN system been initialized
-     */
-    TBool iWlanSystemInitialized;
-
-    /**
      * If a WLAN Management Command is executed asynchronously, this data
      * member is used to store the Management Command message - thus keeping
      * it valid until the asynchronous request is actually scheduled.
--- a/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/RWlanLogicalChannel.inl	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/RWlanLogicalChannel.inl	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 17 %
+* %version: 17.1.1 %
 */
 
 // -----------------------------------------------------------------------------
@@ -39,9 +39,7 @@
     TWlanUnit aUnit, 
     TOpenParam& aOpenParam )
     {
-    iWlanSystemInitialized = EFalse;
-    
-	TInt err = DoCreate(
+    TInt err = DoCreate(
         LDD_NAME, 
         VersionRequired(), 
         aUnit, 
@@ -54,12 +52,6 @@
         // driver load sequence success
         // do system init
         err = InitWlanSystem( aOpenParam  );
-        
-        if ( err == KErrNone )
-            {
-            // WLAN system successfully initialized
-            iWlanSystemInitialized = ETrue;
-            }
         }
 
     return err;
@@ -71,21 +63,12 @@
 //
 inline void RWlanLogicalChannel::CloseChannel()
     {
-    // release WLAN system resources only if we have been able to do the 
-    // initialization successfully.
-    // This check is done to prevent a release attempt in a case where the 
-    // device driver framework has not been properly initialized to be able to 
-    // handle requests
-    if ( iWlanSystemInitialized )
-        {
-        TRequestStatus status;
-        DoRequest( EWlanFinitSystem, status );
-        User::WaitForRequest(status);
-
-        // not initialized any more. This is needed to handle the case
-        // that this method is called multiple times
-        iWlanSystemInitialized = EFalse;
-        }
+    // request WLAN system resources to be released
+    //
+    TRequestStatus status;
+    DoRequest( EWlanFinitSystem, status );
+    User::WaitForRequest(status);
+    
     // internally call close
     Close();
     }
--- a/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/WlanLogicalChannel.cpp	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/WlanLogicalChannel.cpp	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 59 %
+* %version: 59.1.1 %
 */
 
 #include "WlLddWlanLddConfig.h"
@@ -633,7 +633,6 @@
 #else
     iOsa->MutexAcquire();
 #endif
-    NKern::ThreadLeaveCS();
     
     TraceDump(MUTEX, 
         (("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex acquired")));
@@ -705,14 +704,12 @@
         }
     
     // release mutex
-    // Enter critical section before releasing the mutex as
-    // we are executing in the context of a user mode thread
-    NKern::ThreadEnterCS();    
 #ifndef RD_WLAN_DDK
     Kern::MutexSignal( iMutex );
 #else
     iOsa->MutexRelease();
 #endif 
+    // and exit from critical section
     NKern::ThreadLeaveCS();
     
     TraceDump(MUTEX, 
--- a/wlan_plat/wlan_management_api/inc/wlanmgmtcommon.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_plat/wlan_management_api/inc/wlanmgmtcommon.h	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 10 %
+* %version: 10.1.1 %
 */
 
 #ifndef WLANMGMTCOMMON_H
@@ -277,6 +277,22 @@
     TWlanWpaPresharedKey iWpaPreSharedKey;
     };
 
+/**
+ * Data structure for storing IAP availability data.
+ */
+struct TWlanIapAvailabilityData
+    {
+    /**
+     * ID of the IAP.
+     */
+    TUint iIapId;
+    /** 
+     * Received Signal Strength Indicator (RSSI) of the strongest
+     * AP in the network.
+     */
+    TUint iRssi;
+    };
+
 // CLASS DECLARATION
 /** 
  * Callback interface for WLAN management notifications.
--- a/wlan_plat/wlan_management_api/inc/wlanmgmtinterface.h	Tue May 25 14:40:09 2010 +0300
+++ b/wlan_plat/wlan_management_api/inc/wlanmgmtinterface.h	Mon Jun 21 17:43:00 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 16 %
+* %version: 16.1.1 %
 */
 
 #ifndef WLANMGMTINTERFACE_H
@@ -410,6 +410,36 @@
          */
         virtual TInt StartAggressiveBgScan(
             TUint aInterval ) = 0;
+
+        /**
+         * Get the available WLAN IAPs.
+         *
+         * @param aCacheLifetime Defines how many seconds old cached results the client
+         *                       is willing to accept. The valid is range is from 0 to
+         *                       60 seconds. The value of -1 means the system default will
+         *                       be used. The aCacheLifetime parameter has a meaning only
+         *                       when the aMaxDelay parameter is zero.
+         *                       Value will be changed to the actual value used by the
+         *                       system.
+         * @param aMaxDelay Maximum amount of seconds the client is willing to wait for
+         *                  the availability results. The valid range is from 0 to 1200
+         *                  seconds or KWlanInfiniteScanDelay. KWlanInfiniteScanDelay
+         *                  will never cause a scan, but the request will be
+         *                  completed when any other broadcast scan request is completed.
+         *                  Value will be changed to the actual value used by the system.
+         * @param aFilteredResults Whether availability is filtered based on signal strength.
+                                   ETrue if filtering is allowed, EFalse if not.
+         * @param aStatus Status of the calling active object. On successful
+         *                completion contains KErrNone, otherwise one of the
+         *                system-wide error codes.
+         * @param aAvailableIaps Array of IAPs available.
+         */
+        virtual void GetAvailableIaps(
+            TInt& aCacheLifetime,
+            TUint& aMaxDelay,
+            TBool aFilteredResults,
+            TRequestStatus& aStatus,
+            RArray<TWlanIapAvailabilityData>& aAvailableIaps ) = 0;
     };
 
 #endif // WLANMGMTINTERFACE_H