# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1282120502 -10800 # Node ID 3d23268b50f64f7fd5c434ac3cd798a06bcdcc39 # Parent 1c425781161e61be2f782a7e0485c3dd2a3b9fcd Revision: 201033 Kit: 201033 diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_server.h --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_server.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_server.h Wed Aug 18 11:35:02 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& iap_data_list, - core_type_list_c& iap_id_list, + core_type_list_c& iap_availability_list, core_type_list_c* iap_ssid_list, ScanList& scan_data ) = 0; diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_get_available_iaps.h --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_get_available_iaps.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_get_available_iaps.h Wed Aug 18 11:35:02 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& iap_data_list, - core_type_list_c& iap_id_list, + core_type_list_c& iap_availability_list, core_type_list_c* 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& 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& 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& iap_data_list_m; /** - * List for storing IDs of available IAPs. + * List of available IAPs. */ - core_type_list_c& iap_id_list_m; + core_type_list_c& 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 direct_scan_list_m; + + /** + * Iterator for direct scan list. + */ + core_type_list_iterator_c direct_scan_iter_m; /** * Region information that is selected based on the APs country information. diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_server.h --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_server.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_server.h Wed Aug 18 11:35:02 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& iap_data_list, - core_type_list_c& iap_id_list, + core_type_list_c& iap_availability_list, core_type_list_c* iap_ssid_list, ScanList& scan_data ); diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_settings.h --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_settings.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_settings.h Wed Aug 18 11:35:02 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 weak_iap_list_m; - /** Bitmask of enabled features. */ u32_t features_m; diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_types.h --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_types.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_types.h Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 97 % +* %version: 100 % */ #ifndef CORE_TYPES_H @@ -189,7 +189,9 @@ /** Use Wi-Fi Protected Setup, keys are negotiated by EAPOL. */ core_security_mode_protected_setup, /** Use WAPI, keys are negotiated by EAPOL. */ - core_security_mode_wapi + core_security_mode_wapi, + /** Use EAP authentication without encryption. */ + core_security_mode_802dot1x_unencrypted } core_security_mode_e; /** @@ -468,6 +470,7 @@ core_error_wlan_disabled, core_error_already_exists, core_error_eapol_auth_start_timeout, + core_error_unsupported_config } core_error_e; /** @@ -597,6 +600,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 +800,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 +812,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 +1561,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 @@ -2012,7 +2026,8 @@ wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam, wlan_eapol_if_eapol_key_authentication_type_wfa_sc, wlan_eapol_if_eapol_key_authentication_type_wapi_psk, - wlan_eapol_if_eapol_key_authentication_type_wapi + wlan_eapol_if_eapol_key_authentication_type_wapi, + wlan_eapol_if_eapol_key_authentication_type_802_1x_unencrypted } wlan_eapol_if_eapol_key_authentication_type_e; typedef enum _wlan_eapol_if_eapol_key_type_e diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_iap_data.cpp --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_iap_data.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_iap_data.cpp Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 14.1.1 % +* %version: 16 % */ #include "core_iap_data.h" @@ -193,7 +193,8 @@ if ( iap_data_m.security_mode == core_security_mode_802dot1x || iap_data_m.security_mode == core_security_mode_wpa || iap_data_m.security_mode == core_security_mode_wpa2only || - iap_data_m.security_mode == core_security_mode_protected_setup ) + iap_data_m.security_mode == core_security_mode_protected_setup || + iap_data_m.security_mode == core_security_mode_802dot1x_unencrypted ) { return true_t; } diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_check_rcpi.cpp --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_check_rcpi.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_check_rcpi.cpp Wed Aug 18 11:35:02 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( core_rcp_weak ); buf[1] = static_cast( 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 ), diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_get_available_iaps.cpp --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_get_available_iaps.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_get_available_iaps.cpp Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 42 % +* %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& iap_data_list, - core_type_list_c& iap_id_list, + core_type_list_c& iap_availability_list, core_type_list_c* 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 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 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 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( server_m->get_device_settings().rcpi_trigger ); - /** - * 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 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,68 +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; - bool_t is_match_found( true_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 ) - { - DEBUG1( "core_operation_get_available_iaps_c::remove_matching_iaps() - RCPI improved enough (%u), remove IAP ID from weak list", - ap_data.rcpi() ); - *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 ); - } - else - { - DEBUG2( "core_operation_get_available_iaps_c::remove_matching_iaps() - RCPI not improved enough (%u vs %u)", - ap_data.rcpi(), treshold_val ); + 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() ); - is_match_found = false_t; - } - } - 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(); - if( is_match_found ) - { - 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() ); } } } @@ -1242,6 +1115,96 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- +// +bool_t core_operation_get_available_iaps_c::is_ssid_in_list( + const core_ssid_s& ssid, + core_type_list_c& ssid_list ) const + { + core_type_list_iterator_c 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& iap_list ) const + { + core_type_list_iterator_c 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 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, diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_roam.cpp --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_roam.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_roam.cpp Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 76.1.3 % +* %version: 78 % */ #include "core_operation_roam.h" @@ -802,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: @@ -855,7 +855,9 @@ case core_security_mode_allow_unsecure: { break; - } + } + case core_security_mode_802dot1x_unencrypted: + /** Falls through on purpose. */ case core_security_mode_802dot1x: { if ( request_status == core_error_eapol_total_failure || @@ -925,6 +927,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; } @@ -951,6 +967,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. */ @@ -997,7 +1022,8 @@ eap_error ); core_connect_status_e status( core_connect_wpa_eap_failure ); - if ( security_mode == core_security_mode_802dot1x ) + if ( security_mode == core_security_mode_802dot1x || + security_mode == core_security_mode_802dot1x_unencrypted ) { status = core_connect_802_1x_failure; } diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_server.cpp --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_server.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_server.cpp Wed Aug 18 11:35:02 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& iap_data_list, - core_type_list_c& iap_id_list, + core_type_list_c& iap_availability_list, core_type_list_c* 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 ); diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_settings.cpp --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_settings.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_settings.cpp Wed Aug 18 11:35:02 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 ) diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_wpa_connect.cpp --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_wpa_connect.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_wpa_connect.cpp Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 59.1.1 % +* %version: 62 % */ #include "core_sub_operation_wpa_connect.h" @@ -313,6 +313,14 @@ encryption_mode = core_encryption_mode_wpi; break; } + case wlan_eapol_if_eapol_key_authentication_type_802_1x_unencrypted: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using key management core_key_management_none" ); + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using encryption mode core_encryption_mode_disabled" ); + key_management = core_key_management_none; + encryption_mode = core_encryption_mode_disabled; + break; + } default: { DEBUG( "core_sub_operation_wpa_connect_c::next_state() - unknown authentication type" ); diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_tools.cpp --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_tools.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_tools.cpp Wed Aug 18 11:35:02 2010 +0300 @@ -484,8 +484,8 @@ DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_802_1x" ); return wlan_eapol_if_eapol_key_authentication_type_802_1x; } - else if( mode == core_security_mode_802dot1x && - ap_data.key_management_suites() & core_key_management_wpx_fast_roam ) + else if( (mode == core_security_mode_802dot1x || core_security_mode_802dot1x_unencrypted) && + (ap_data.key_management_suites() & core_key_management_wpx_fast_roam) ) { DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam" ); return wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam; @@ -495,6 +495,21 @@ DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_wfa_sc" ); return wlan_eapol_if_eapol_key_authentication_type_wfa_sc; } + if( mode == core_security_mode_802dot1x_unencrypted && + !ap_data.is_rsn_ie_present() && + !ap_data.is_wpa_ie_present() ) + { + if( !ap_data.is_privacy_enabled() ) + { + DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_802_1x_unencrypted" ); + return wlan_eapol_if_eapol_key_authentication_type_802_1x_unencrypted; + } + else + { + DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_802_1x" ); + return wlan_eapol_if_eapol_key_authentication_type_802_1x; + } + } else if( iap_data.is_eap_used() ) { if( ap_data.is_rsn_ie_present() ) diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_tools_parser.cpp --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_tools_parser.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_tools_parser.cpp Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 35 % +* %version: 37 % */ #include "core_tools_parser.h" @@ -146,6 +146,8 @@ } break; + case core_security_mode_802dot1x_unencrypted: + /** Falls through on purpose. */ case core_security_mode_802dot1x: /** * Check WPX requirements. @@ -373,6 +375,7 @@ break; } + } DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - OK" ); diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/genscanlist.cpp --- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/genscanlist.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/genscanlist.cpp Wed Aug 18 11:35:02 2010 +0300 @@ -28,11 +28,15 @@ const u8_t IE_OFFSET_LENGTH = 1; /** The number of mandatory IEs. */ const u8_t MANDATORY_IE_LIST_SIZE = 3; -/** Array element IDs of mandatory IEs. */ -const u8_t MANDATORY_IE_LIST[] = - { 0, // SSID - 1, // Supported Rates - 3 }; // DS +/** Array of mandatory IEs and their minimum and maximum lengths. */ +const u8_t MANDATORY_IE_LIST[][3] = + { { 0, 0, 32 }, // SSID + { 1, 1, 255 }, // Supported Rates + { 3, 1, 255 } }; // DS +/** Indexes for the IE array. */ +const u8_t MANDATORY_IE_ID = 0; +const u8_t MANDATORY_IE_MIN_LENGTH = 1; +const u8_t MANDATORY_IE_MAX_LENGTH = 2; /** Defining this enables memory allocation related traces. */ //#define SCANLIST_DEEP_DEBUG 1 @@ -246,13 +250,18 @@ { if ( current_ie < data + size ) { /** Still searching... */ - if ( current_ie[IE_OFFSET_ELEMENT_ID] == MANDATORY_IE_LIST[i] ) + if ( current_ie[IE_OFFSET_ELEMENT_ID] == MANDATORY_IE_LIST[i][MANDATORY_IE_ID] && + current_ie[IE_OFFSET_LENGTH] >= MANDATORY_IE_LIST[i][MANDATORY_IE_MIN_LENGTH] && + current_ie[IE_OFFSET_LENGTH] <= MANDATORY_IE_LIST[i][MANDATORY_IE_MAX_LENGTH] ) { /** We have a match! Lets find out the next one. */ is_found = true_t; } } else { /** The IE was not found. */ + DEBUG1( "ScanList::CheckData() - Element ID %u not found, ignoring frame", + MANDATORY_IE_LIST[i][MANDATORY_IE_ID] ); + return false_t; } } diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmserveru.def --- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmserveru.def Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmserveru.def Wed Aug 18 11:35:02 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 &) ?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) diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmserveru.def --- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmserveru.def Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmserveru.def Wed Aug 18 11:35:02 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 diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/rwlmserver.h --- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/rwlmserver.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/rwlmserver.h Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 27 % +* %version: 28 % */ #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 ); /** diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtimpl.h --- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtimpl.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtimpl.h Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 22 % +* %version: 23 % */ #ifndef WLANMGMTIMPL_H @@ -380,6 +380,7 @@ TWlanConnectionExtentedSecurityMode& aMode ); /** + * (From MWlanMgmtInterface) * Activate the extended notification service. * * After the client has enabled the notification service, it can @@ -394,6 +395,7 @@ TUint aCallbackInterfaceVersion ); /** + * (From MWlanMgmtInterface) * Create a virtual traffic stream. * * @param aStatus Status of the calling active object. On successful @@ -412,11 +414,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 @@ -429,11 +433,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 @@ -447,6 +453,7 @@ const TWlanBssid& aBssid ); /** + * (From MWlanMgmtInterface) * Cancel an outstanding directed roam request. */ virtual void CancelDirectedRoam(); @@ -459,6 +466,7 @@ TInt aStatus ); /** + * (From MWlanMgmtInterface) * Start aggressive background scanning. * @param aInterval Scan interval for aggressive mode (in seconds). * Valid range: 1-120 seconds. @@ -466,6 +474,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& aAvailableIaps ); + protected: // Methods /** @@ -691,6 +730,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& aAvailableIaps, + TInt& aCacheLifetime, + TUint& aMaxDelay, + TBool aFilteredResults ); + + /** * Destructor. */ virtual ~CWlanAvailableIapsRequest(); @@ -733,12 +789,17 @@ // Interface to RWLMServer RWLMServer& iServer; - // Handle to client storage for available IAPs - RArray& iPendingAvailableIaps; - + // Handle to client storage for available IAP IDs for legacy methods. + // Not owned by this pointer. + RArray* iPendingAvailableIapIds; + + // Handle to client storage for available IAPs. + // Not owned by this pointer. + RArray* iPendingAvailableIaps; + // Storage for available IAPs TWlmAvailableIaps iAvailableIaps; - + // The package buffer needed for the asynchronous request TPckg iAvailableIapsBuf; @@ -748,6 +809,8 @@ // The package buffer needed for the asynchronous request TPckg iMaxDelayBuf; + // Whether availability is filtered based on signal strength. + TBool iFilteredResults; }; diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanresultcache.h --- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanresultcache.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanresultcache.h Wed Aug 18 11:35:02 2010 +0300 @@ -15,6 +15,9 @@ * */ +/* +* %version: 13 % +*/ #ifndef WLANSCANRESULTCACHE_H #define WLANSCANRESULTCACHE_H @@ -33,6 +36,7 @@ TBuf8 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& aIapIdList, + core_type_list_c& aIapAvailabilityList, RArray& 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* AvailableIaps( + RArray* AvailableIaps( RArray& 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& aFirst, const RArray& aSecond ); @@ -177,7 +191,7 @@ RArray iIapList; /** Latest list of available IAPs */ - RArray iAvailableIapList; + RArray iAvailableIapList; /** Latest list of available networks */ RArray iAvailableNetworkList; diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmclientserver.h --- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmclientserver.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmclientserver.h Wed Aug 18 11:35:02 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 iaps; + TFixedArray iaps; }; /** diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmserver.h --- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmserver.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmserver.h Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 57 % +* %version: 59 % */ #ifndef WLMSERVER_H @@ -79,6 +79,10 @@ public MWlanEapolCallbackInterface, public MWlanScanResultProvider { + + // Friend class for Unit Testing + friend class UT_CWlmServer; + public: // Constructors and destructor /** @@ -94,6 +98,7 @@ TAny* iParam1; TAny* iParam2; TAny* iParam3; + TAny* iParam4; TUint* iTime; SRequestMapEntry() : @@ -104,6 +109,7 @@ iParam1( NULL ), iParam2( NULL ), iParam3( NULL ), + iParam4( NULL ), iTime( NULL ) { } }; @@ -983,11 +989,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* aIapIdList ); + core_type_list_c& aIapAvailabilityData ); /** * Check if this request can be completed. @@ -1411,7 +1417,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 iIapWeakList; + + /** + * IAP ID of the connection. + */ + TUint iConnectionIapId; }; diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/rwlmserver.cpp --- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/rwlmserver.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/rwlmserver.cpp Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 30 % +* %version: 31 % */ #include @@ -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 inPckg( aAvailableIaps ); TPckg inPckg2( aCacheLifetime ); TPckg 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 ); } diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanconversionutil.cpp --- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanconversionutil.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanconversionutil.cpp Wed Aug 18 11:35:02 2010 +0300 @@ -16,12 +16,12 @@ */ /* -* %version: 87 % +* %version: 89 % */ #include #include - +#include #include "wlanconversionutil.h" #include "wlmserver.h" #include "wlmtsparams.h" @@ -443,6 +443,8 @@ return KErrWlanInternalError; case core_connect_wapi_certificate_failure: return KErrWlanInternalError; + case core_connect_ap_unsupported_configuration: + return KErrIfAuthenticationFailure; default: return KErrUnknown; } @@ -783,7 +785,14 @@ aCoreSettings.security_mode = core_security_mode_wep; break; case Wlan8021x: - aCoreSettings.security_mode = core_security_mode_802dot1x; + if( aAmSettings.WPAKeyLength == 1 ) + { + aCoreSettings.security_mode = core_security_mode_802dot1x_unencrypted; + } + else + { + aCoreSettings.security_mode = core_security_mode_802dot1x; + } break; case Wpa: aCoreSettings.security_mode = core_security_mode_wpa; @@ -1015,6 +1024,7 @@ case core_error_challenge_failure: case core_error_not_connected: case core_error_general: + case core_error_unsupported_config: default: return KErrGeneral; } @@ -1046,6 +1056,8 @@ return core_error_cancel; case KErrAlreadyExists: return core_error_already_exists; + case KWlanErrUnsupportedNwConf: + return core_error_unsupported_config; default: return core_error_general; } diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanmgmtimpl.cpp --- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanmgmtimpl.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanmgmtimpl.cpp Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 32 % +* %version: 34 % */ // 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; @@ -684,7 +684,7 @@ // void CWlanMgmtImpl::ActivateExtendedNotificationsL( MWlanMgmtNotifications& aCallback, - TUint aCallbackInterfaceVersion = KWlanCallbackInterfaceVersion ) + TUint aCallbackInterfaceVersion ) { TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::ActivateExtendedNotificationsL()" ) ) ); iClientNotification = &aCallback; @@ -799,6 +799,33 @@ } // --------------------------------------------------------- +// CWlanMgmtImpl::GetAvailableIaps +// --------------------------------------------------------- +// +void CWlanMgmtImpl::GetAvailableIaps( + TInt& aCacheLifetime, + TUint& aMaxDelay, + TBool aFilteredResults, + TRequestStatus& aStatus, + RArray& 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 // --------------------------------------------------------- // @@ -1069,10 +1096,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& 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 ); @@ -1083,6 +1136,8 @@ { TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::CWlanAvailableIapsRequest()" ) ) ); Cancel(); + iPendingAvailableIapIds = NULL; + iPendingAvailableIaps = NULL; } // --------------------------------------------------------- @@ -1092,7 +1147,7 @@ void CWlanAvailableIapsRequest::IssueRequest() { TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::IssueRequest()" ) ) ); - iServer.GetAvailableIaps( iAvailableIapsBuf, iCacheLifetimeBuf, iMaxDelayBuf, iStatus ); + iServer.GetAvailableIaps( iAvailableIapsBuf, iCacheLifetimeBuf, iMaxDelayBuf, iFilteredResults, iStatus ); SetActive(); } @@ -1103,9 +1158,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() ); } diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanscanresultcache.cpp --- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanscanresultcache.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanscanresultcache.cpp Wed Aug 18 11:35:02 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& aIapIdList, + core_type_list_c& aIapAvailabilityList, RArray& 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 isEqual( CWlanScanResultCache::IsNetworkEqual ); + TIdentityRelation isNetworkEqual( CWlanScanResultCache::IsNetworkEqual ); + TIdentityRelation 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* CWlanScanResultCache::AvailableIaps( +RArray* CWlanScanResultCache::AvailableIaps( RArray& 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 // ----------------------------------------------------------------------------- // diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmserver.cpp --- a/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmserver.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmserver.cpp Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 109 % +* %version: 111 % */ #include @@ -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(); @@ -660,7 +660,8 @@ TInt ret = GetCurrentIapId( static_cast(lanServiceId), *coreIapData ); - + iConnectionIapId = coreIapData->iap_id; + if ( ret != KErrNone ) { secondarySsidList.Close(); @@ -1223,6 +1224,10 @@ // Read cacheLifetime and maxDelay arguments TPckgBuf cacheLifetimePckg( KWlmDefaultScanCacheLifetime ); TPckgBuf 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" ); @@ -1254,28 +1259,47 @@ * See if cached IAP availability information is available. */ RArray iapList; - RArray* list = iCache->AvailableIaps( - iapList, - ( cacheLifetimePckg() == 0 ? 1 : cacheLifetimePckg() ) ); - + RArray* 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 outPckg( tmp ); aMessage.Write( 0, outPckg ); aMessage.Complete( KErrNone ); @@ -1330,8 +1354,9 @@ iapList.Close(); // Create output list - core_type_list_c* iapIdList = new core_type_list_c; - if( iapIdList == NULL ) + core_type_list_c* iapAvailabilityList = + new core_type_list_c; + if( iapAvailabilityList == NULL ) { aMessage.Complete( KErrNoMemory ); delete iapDataList; @@ -1346,7 +1371,7 @@ aMessage.Complete( KErrNoMemory ); delete iapDataList; delete iapSsidList; - delete iapIdList; + delete iapAvailabilityList; return; } @@ -1362,7 +1387,7 @@ aMessage.Complete( KErrNoMemory ); delete iapDataList; delete iapSsidList; - delete iapIdList; + delete iapAvailabilityList; delete scanList; return; @@ -1382,9 +1407,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( isFiltered ); mapEntry.iTime = scanTime; iRequestMap.Append( mapEntry ); @@ -1510,7 +1536,8 @@ return err; } - + iDeviceSettings = settings; + // Only if startup is complete, inform current settings to BgScan if( iIsStartupComplete ) { @@ -1645,12 +1672,11 @@ // void CWlmServer::NotifyBackgroundScanDone( ScanList* aScanList, - core_type_list_c* aIapIdList ) + core_type_list_c& aIapAvailabilityData ) { DEBUG( "CWlmServer::NotifyBackgroundScanDone()" ); ASSERT( aScanList != NULL ); - ASSERT( aIapIdList != NULL ); - + // Unload the drivers immediately to conserve power. if( !iPlatform->IsWlanDisabled() && iConnectionState == EWlanStateNotConnected ) @@ -1666,7 +1692,7 @@ TBool newIaps( EFalse ); TBool lostIaps( EFalse ); iCache->UpdateAvailableNetworksList( - *aIapIdList, + aIapAvailabilityData, networkList, newIaps, lostIaps ); @@ -1813,6 +1839,7 @@ case EWlanStateNotConnected: DEBUG( "CWlmServer::notify() - STATE: EWlanStateNotConnected" ); iIsRoaming = EFalse; + iConnectionIapId = 0; // set icon to "not available" SetIconState( EWlmIconStatusNotAvailable ); @@ -1897,6 +1924,29 @@ case EWlmNotifyAcTrafficStatusChanged: DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficStatusChanged" ); break; + case EWlmNotifyRcpChanged: + DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyRcpChanged" ); + if( static_cast( 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; } @@ -2622,9 +2672,8 @@ ScanList* scanList = reinterpret_cast( aRequest.iParam2 ); - core_type_list_c* idList = - reinterpret_cast*>( aRequest.iParam1 ); - + core_type_list_c* iapAvailabilityList = + reinterpret_cast*>( aRequest.iParam1 ); core_type_list_c* iapDataList = reinterpret_cast*>( aRequest.iParam0 ); delete iapDataList; @@ -2640,7 +2689,7 @@ if( aStatus == core_error_ok ) { - NotifyBackgroundScanDone( scanList, idList ); + NotifyBackgroundScanDone( scanList, *iapAvailabilityList ); // cache takes the ownership of the scanList scanList = NULL; } @@ -2652,8 +2701,8 @@ delete scanList; scanList = NULL; - delete idList; - idList = NULL; + delete iapAvailabilityList; + iapAvailabilityList = NULL; break; } @@ -2789,29 +2838,33 @@ // Create pointers to parameters core_type_list_c* iapSsidList; ScanList* scanList; - core_type_list_c* coreIdList; + core_type_list_c* coreAvailabilityList; core_type_list_c* iapDataList; + TBool isFiltered( reinterpret_cast( aRequest.iParam4 ) ); + DEBUG1( "CWlmServer::CompleteExternalRequest() - isFiltered: %u", + isFiltered ); iapSsidList = reinterpret_cast*>( aRequest.iParam3 ); iapDataList = reinterpret_cast*>( aRequest.iParam0 ); TUint* completedScanTime = reinterpret_cast( aRequest.iTime ); ScanList* completedScanList = reinterpret_cast( aRequest.iParam2); - core_type_list_c* completedIdList = reinterpret_cast*>( aRequest.iParam1 ); + core_type_list_c* completedAvailabilityList = + reinterpret_cast*>( aRequest.iParam1 ); if( aTriggerRequest == NULL ) { DEBUG( "CWlmServer::CompleteExternalRequest() - GetAvailableIaps request handled by core" ); scanList = reinterpret_cast( aRequest.iParam2); - coreIdList = reinterpret_cast*>( aRequest.iParam1 ); + coreAvailabilityList = reinterpret_cast*>( 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( aTriggerRequest->iParam2); - coreIdList = reinterpret_cast*>( aTriggerRequest->iParam1 ); + coreAvailabilityList = reinterpret_cast*>( aTriggerRequest->iParam1 ); } delete iapSsidList; @@ -2831,27 +2884,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 outPckg( tmp ); @@ -2859,14 +2960,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; } @@ -2887,14 +2988,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; } } @@ -3026,6 +3127,7 @@ TWlanAvailableNetwork network; network.ssid.Copy( ieData, ieLength ); network.securityMode = info.SecurityMode(); + network.rcpi = info.RXLevel(); if( info.OperatingMode() == WlanOperatingModeInfra ) { network.networkType = Infrastructure; @@ -3035,12 +3137,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; + } } } @@ -3433,8 +3541,9 @@ iapList.Close(); // Create output list - core_type_list_c* iapIdList = new core_type_list_c; - if( iapIdList == NULL ) + core_type_list_c* iapAvailabilityList = + new core_type_list_c; + if( iapAvailabilityList == NULL ) { DEBUG( "ERROR: Out of memory" ); delete iapDataList; @@ -3449,7 +3558,7 @@ DEBUG( "CWlmServer::BackgroundScanRequest() - Out of memory when instantiating ScanList" ); delete iapDataList; delete iapSsidList; - delete iapIdList; + delete iapAvailabilityList; return KErrNoMemory; } @@ -3461,7 +3570,7 @@ delete iapDataList; delete iapSsidList; - delete iapIdList; + delete iapAvailabilityList; delete scanList; return KErrNoMemory; } @@ -3472,12 +3581,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( 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 @@ -3547,7 +3657,15 @@ if( self->IsSessionActive( self->iRequestMap[index] ) ) { self->iRequestMap[index].iMessage.Write( 2, pckgDynamicScanList ); - self->iRequestMap[index].iMessage.Complete( KErrNone ); + + if( self->iPlatform->GetWlanOnOffState() != EWlanOn ) + { + self->iRequestMap[index].iMessage.Complete( self->iPlatform->GetWlanOnOffState() ); + } + else + { + self->iRequestMap[index].iMessage.Complete( KErrServerBusy ); + } } delete completedScanList; @@ -3576,7 +3694,8 @@ DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - GetAvailableIaps" ); core_type_list_c* iapDataList = reinterpret_cast*>( self->iRequestMap[index].iParam0 ); - core_type_list_c* iapIdList = reinterpret_cast*>( self->iRequestMap[index].iParam1 ); + core_type_list_c* iapAvailabilityList = + reinterpret_cast*>( self->iRequestMap[index].iParam1 ); ScanList* scanList = reinterpret_cast( self->iRequestMap[index].iParam2 ); core_type_list_c* iapSsidList = reinterpret_cast*>( self->iRequestMap[index].iParam3 ); TUint* scanTime = reinterpret_cast( self->iRequestMap[index].iTime ); @@ -3600,13 +3719,25 @@ TWlmAvailableIaps tmp = { 0 }; TPckg outPckg( tmp ); self->iRequestMap[index].iMessage.Write( 0, outPckg ); - self->iRequestMap[index].iMessage.Complete( KErrNone ); + + if( self->iPlatform->GetWlanOnOffState() != EWlanOn ) + { + self->iRequestMap[index].iMessage.Complete( self->iPlatform->GetWlanOnOffState() ); + } + else if( iapDataList->count() == 0 ) + { + self->iRequestMap[index].iMessage.Complete( KErrNone ); + } + else + { + self->iRequestMap[index].iMessage.Complete( KErrServerBusy ); + } } delete iapDataList; iapDataList = NULL; - delete iapIdList; - iapIdList = NULL; + delete iapAvailabilityList; + iapAvailabilityList = NULL; delete scanList; scanList = NULL; delete iapSsidList; @@ -3655,14 +3786,15 @@ // pass request to core core_type_list_c* iapDataList = reinterpret_cast*>( self->iRequestMap[index].iParam0 ); core_type_list_c* iapSsidList = reinterpret_cast*>( self->iRequestMap[index].iParam3 ); - core_type_list_c* iapIdList = reinterpret_cast*>( self->iRequestMap[index].iParam1 ); + core_type_list_c* iapAvailabilityList = + reinterpret_cast*>( self->iRequestMap[index].iParam1 ); ScanList* scanList = reinterpret_cast( self->iRequestMap[index].iParam2 ); self->iCoreServer->get_available_iaps( self->iRequestMap[index].iRequestId, isActiveScanAllowed, *iapDataList, - *iapIdList, + *iapAvailabilityList, iapSsidList, *scanList ); @@ -3694,14 +3826,15 @@ // pass request to core core_type_list_c* iapDataList = reinterpret_cast*>( self->iRequestMap[index].iParam0 ); core_type_list_c* iapSsidList = reinterpret_cast*>( self->iRequestMap[index].iParam3 ); - core_type_list_c* iapIdList = reinterpret_cast*>( self->iRequestMap[index].iParam1 ); + core_type_list_c* iapAvailabilityList = + reinterpret_cast*>( self->iRequestMap[index].iParam1 ); ScanList* scanList = reinterpret_cast( self->iRequestMap[index].iParam2 ); self->iCoreServer->get_available_iaps( self->iRequestMap[index].iRequestId, isActiveScanAllowed, *iapDataList, - *iapIdList, + *iapAvailabilityList, iapSsidList, *scanList ); @@ -4103,7 +4236,7 @@ DEBUG( "CWlmServer::CancelScan() - remove entry from request map" ); SRequestMapEntry entry = iRequestMap[index]; delete reinterpret_cast*>( entry.iParam0 ); - delete reinterpret_cast*>( entry.iParam1 ); + delete reinterpret_cast*>( entry.iParam1 ); delete reinterpret_cast( entry.iParam2); delete reinterpret_cast*>( entry.iParam3 ); delete reinterpret_cast( entry.iTime ); @@ -4140,7 +4273,7 @@ DEBUG( "CWlmServer::CancelScan() - remove entry from request map" ); SRequestMapEntry entry = iRequestMap[index]; delete reinterpret_cast*>( entry.iParam0 ); - delete reinterpret_cast*>( entry.iParam1 ); + delete reinterpret_cast*>( entry.iParam1 ); delete reinterpret_cast( entry.iParam2); delete reinterpret_cast*>( entry.iParam3 ); delete reinterpret_cast( entry.iTime ); @@ -5067,8 +5200,8 @@ ScanList* scanList = reinterpret_cast( aMapEntry.iParam2 ); - core_type_list_c* iapIdList = - reinterpret_cast*>( aMapEntry.iParam1 ); + core_type_list_c* iapAvailabilityList = + reinterpret_cast*>( aMapEntry.iParam1 ); /** * Go through the IAP list and find IAPs that haven't been found @@ -5077,14 +5210,14 @@ RArray attachedIapList; CleanupClosePushL( attachedIapList ); const RArray& cachedIapList( - iCache->CachedIapDataList() ); - core_type_list_iterator_c iter( *iapIdList ); + iCache->CachedIapDataList() ); + core_type_list_iterator_c 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; } @@ -5131,11 +5264,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; } } @@ -5147,10 +5282,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 { diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11State.h --- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11State.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11State.h Wed Aug 18 11:35:02 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, diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Synchronize.h --- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Synchronize.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Synchronize.h Wed Aug 18 11:35:02 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 diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umac_types.h --- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umac_types.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umac_types.h Wed Aug 18 11:35:02 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 */ diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdynamicpowermodemgmtcntx.h --- a/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdynamicpowermodemgmtcntx.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdynamicpowermodemgmtcntx.h Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 13 % +* %version: 14 % */ #ifndef WLAN_DYNAMIC_POWER_MODE_MGMT_CNTX @@ -205,7 +205,7 @@ void FreezeTrafficOverride(); /** - * Restores the Ative mode parameters back to their WLAN Mgmt Client + * Restores the Active mode parameters back to their WLAN Mgmt Client * provided values */ inline void RestoreActiveModeParameters(); diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Idle.cpp --- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Idle.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Idle.cpp Wed Aug 18 11:35:02 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; diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11State.cpp --- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11State.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11State.cpp Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 89 % +* %version: 90 % */ #include "config.h" @@ -3240,14 +3240,14 @@ // // ----------------------------------------------------------------------------- // -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(); @@ -3292,7 +3292,7 @@ OsTracePrint( KWarningLevel, (TUint8*) ("UMAC: WlanDot11State::InitNetworkConnect: WAPI requested but not supported by wlanpdd -> abort") ); - return EFalse; + return KErrNotSupported; } //============================================= @@ -3306,7 +3306,7 @@ OsTracePrint( KWarningLevel, (TUint8*) ("UMAC: WlanDot11State::InitNetworkConnect: network capabilities not met -> abort") ); - return EFalse; + return KWlanErrUnsupportedNwConf; } // initialize element locator for locating IEs from the scan response @@ -3337,7 +3337,7 @@ OsTracePrint( KWarningLevel, (TUint8*) ("UMAC: WlanDot11State::InitNetworkConnect: 802Dot11DsParameterSetIE not found -> abort") ); - return EFalse; + return KWlanErrUnsupportedNwConf; } //============================================= @@ -3356,7 +3356,7 @@ OsTracePrint( KWarningLevel, (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: zero beacon interval -> abort") ); - return EFalse; + return KWlanErrUnsupportedNwConf; } //============================================= @@ -3466,7 +3466,7 @@ OsTracePrint( KWarningLevel, (TUint8*) ("UMAC: WlanDot11State::InitNetworkConnect: Nw's 802.11n requirements not met -> abort") ); - return EFalse; + return KWlanErrUnsupportedNwConf; } } else @@ -3536,7 +3536,7 @@ OsTracePrint( KWarningLevel, (TUint8*) ("UMAC: WlanDot11State::InitNetworkConnect: supported rates IE not found -> abort") ); - return EFalse; + return KWlanErrUnsupportedNwConf; } // locate extended supported rates information element @@ -3551,13 +3551,14 @@ // ...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 + // 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; + return KWlanErrUnsupportedNwConf; } } else @@ -3565,14 +3566,14 @@ 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 + // 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; + return KWlanErrUnsupportedNwConf; } } @@ -3581,7 +3582,7 @@ //============================================= DetermineAcUapsdUsage( aCtxImpl ); - return ETrue; + return KErrNone; } // ----------------------------------------------------------------------------- @@ -4925,7 +4926,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 { @@ -4933,7 +4935,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; @@ -4963,16 +4966,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; diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Synchronize.cpp --- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Synchronize.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Synchronize.cpp Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 30 % +* %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(); @@ -507,7 +505,7 @@ return InitNetworkConnect( aCtxImpl, aCtxImpl.ScanResponseFrameBodyLength(), - aCtxImpl.ScanResponseFrameBody() ); + aCtxImpl.ScanResponseFrameBody() ); } // ----------------------------------------------------------------------------- @@ -987,7 +985,7 @@ // make a note of the failure and act // accordingly when we // soon again enter this state - iJoinFailed = ETrue; + iJoinStatus = KErrGeneral; } else { diff -r 1c425781161e -r 3d23268b50f6 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11ibssnormalmode.cpp --- a/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11ibssnormalmode.cpp Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11ibssnormalmode.cpp Wed Aug 18 11:35:02 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; diff -r 1c425781161e -r 3d23268b50f6 wlan_plat/wlan_management_api/inc/wlanmgmtcommon.h --- a/wlan_plat/wlan_management_api/inc/wlanmgmtcommon.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_plat/wlan_management_api/inc/wlanmgmtcommon.h Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 11 % +* %version: 12 % */ #ifndef WLANMGMTCOMMON_H @@ -283,6 +283,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. diff -r 1c425781161e -r 3d23268b50f6 wlan_plat/wlan_management_api/inc/wlanmgmtinterface.h --- a/wlan_plat/wlan_management_api/inc/wlanmgmtinterface.h Tue Jul 06 16:24:00 2010 +0300 +++ b/wlan_plat/wlan_management_api/inc/wlanmgmtinterface.h Wed Aug 18 11:35:02 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 17 % +* %version: 18 % */ #ifndef WLANMGMTINTERFACE_H @@ -414,6 +414,35 @@ 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& aAvailableIaps ) = 0; }; #endif // WLANMGMTINTERFACE_H