205 } |
205 } |
206 core_mac_address_s core_mac( ZERO_MAC_ADDR ); |
206 core_mac_address_s core_mac( ZERO_MAC_ADDR ); |
207 TWlanConversionUtil::ConvertMacAddress( core_mac, mac ); |
207 TWlanConversionUtil::ConvertMacAddress( core_mac, mac ); |
208 |
208 |
209 // Get Device Settings |
209 // Get Device Settings |
210 CWlanDeviceSettings::SWlanDeviceSettings deviceSettings; |
210 GetWlanSettingsL( iDeviceSettings ); |
211 GetWlanSettingsL( deviceSettings ); |
211 SetCachedRegion(iDeviceSettings.region, iDeviceSettings.regionTimestamp); |
212 SetCachedRegion(deviceSettings.region, deviceSettings.regionTimestamp); |
|
213 core_device_settings_s coreSettings; // core needs the settings here |
212 core_device_settings_s coreSettings; // core needs the settings here |
214 TWlanConversionUtil::ConvertDeviceSettings( coreSettings, deviceSettings ); |
213 TWlanConversionUtil::ConvertDeviceSettings( coreSettings, iDeviceSettings ); |
215 |
214 |
216 // Create core server |
215 // Create core server |
217 User::LeaveIfNull( iCoreServer = core_server_factory_c::instance( |
216 User::LeaveIfNull( iCoreServer = core_server_factory_c::instance( |
218 *this, |
217 *this, |
219 *iDriverIf, |
218 *iDriverIf, |
220 coreSettings, |
219 coreSettings, |
221 core_mac, |
220 core_mac, |
222 TWlanConversionUtil::ConvertFeatureFlags( |
221 TWlanConversionUtil::ConvertFeatureFlags( |
223 iSupportedFeatures, |
222 iSupportedFeatures, |
224 deviceSettings.enabledFeatures ) ) ); |
223 iDeviceSettings.enabledFeatures ) ) ); |
225 iCoreServer->disable_wlan( KWlanIntCmdDisableWlan ); |
224 iCoreServer->disable_wlan( KWlanIntCmdDisableWlan ); |
226 |
225 |
227 // Create scan timer |
226 // Create scan timer |
228 DEBUG( "CWlmServer::ConstructL() - create backgroundscan timer" ); |
227 DEBUG( "CWlmServer::ConstructL() - create backgroundscan timer" ); |
229 TCallBack expiredCb( ScanSchedulingTimerExpired, this ); |
228 TCallBack expiredCb( ScanSchedulingTimerExpired, this ); |
1208 DEBUG( "CWlmServer::GetAvailableIaps()" ); |
1209 DEBUG( "CWlmServer::GetAvailableIaps()" ); |
1209 |
1210 |
1210 // Read cacheLifetime and maxDelay arguments |
1211 // Read cacheLifetime and maxDelay arguments |
1211 TPckgBuf<TInt> cacheLifetimePckg( KWlmDefaultScanCacheLifetime ); |
1212 TPckgBuf<TInt> cacheLifetimePckg( KWlmDefaultScanCacheLifetime ); |
1212 TPckgBuf<TUint> maxDelayPckg( 0 ); |
1213 TPckgBuf<TUint> maxDelayPckg( 0 ); |
|
1214 TBool isFiltered( |
|
1215 aMessage.Int3() ); |
|
1216 DEBUG1( "CWlmServer::GetAvailableIaps() - isFiltered: %u", |
|
1217 isFiltered ); |
1213 if( aMessage.Read( 1, cacheLifetimePckg ) != KErrNone ) |
1218 if( aMessage.Read( 1, cacheLifetimePckg ) != KErrNone ) |
1214 { |
1219 { |
1215 DEBUG( "CWlmServer::GetAvailableIaps() - unable to read lifetime parameter" ); |
1220 DEBUG( "CWlmServer::GetAvailableIaps() - unable to read lifetime parameter" ); |
1216 |
1221 |
1217 aMessage.Complete( KErrArgument ); |
1222 aMessage.Complete( KErrArgument ); |
1239 |
1244 |
1240 /** |
1245 /** |
1241 * See if cached IAP availability information is available. |
1246 * See if cached IAP availability information is available. |
1242 */ |
1247 */ |
1243 RArray<TWlanLimitedIapData> iapList; |
1248 RArray<TWlanLimitedIapData> iapList; |
1244 RArray<TUint>* list = iCache->AvailableIaps( |
1249 RArray<TWlmAvailabilityData>* list = iCache->AvailableIaps( |
1245 iapList, |
1250 iapList, |
1246 ( cacheLifetimePckg() == 0 ? 1 : cacheLifetimePckg() ) ); |
1251 ( cacheLifetimePckg() == 0 ? 1 : cacheLifetimePckg() ) ); |
1247 |
|
1248 // Only complete with valid cache if maxDelay is zero |
1252 // Only complete with valid cache if maxDelay is zero |
1249 if( list && maxDelayPckg() == 0 ) |
1253 if( list && maxDelayPckg() == 0 ) |
1250 { |
1254 { |
1251 |
1255 TWlmAvailableIaps tmp = { 0 }; |
1252 TWlmAvailableIaps tmp; |
1256 if( isFiltered ) |
1253 const TInt listCount( |
1257 { |
1254 Min( list->Count(), KWlmMaxAvailableIaps ) ); |
1258 DEBUG1( "CWlmServer::GetAvailableIaps() - using filtered cached IAP list, list contains %d IAP(s)", |
1255 |
1259 list->Count() ); |
1256 DEBUG1( "CWlmServer::GetAvailableIaps() - using cached IAP list, list contains %d IAP(s)", listCount ); |
1260 |
1257 |
1261 for( TInt idx( 0 ); idx < list->Count() && tmp.count < KWlmMaxAvailableIaps; ++idx ) |
1258 TInt listIdx( 0 ); |
1262 { |
1259 |
1263 if( (*list)[idx].rcpi >= iDeviceSettings.minRcpiForIapAvailability && |
1260 while( listIdx < listCount ) |
1264 iIapWeakList.Find( (*list)[idx].iapId ) == KErrNotFound ) |
1261 { |
1265 { |
1262 tmp.iaps[ listIdx ] = (*list)[listIdx]; |
1266 DEBUG2( "CWlmServer::GetAvailableIaps() - IAP %u is available, RCPI is %u", |
1263 ++listIdx; |
1267 (*list)[idx].iapId, (*list)[idx].rcpi ); |
1264 } |
1268 tmp.iaps[tmp.count++] = (*list)[idx]; |
1265 tmp.count = listCount; |
1269 } |
|
1270 else |
|
1271 { |
|
1272 DEBUG2( "CWlmServer::GetAvailableIaps() - IAP %u filtered, RCPI is %u", |
|
1273 (*list)[idx].iapId, (*list)[idx].rcpi ); |
|
1274 } |
|
1275 } |
|
1276 } |
|
1277 else |
|
1278 { |
|
1279 DEBUG1( "CWlmServer::GetAvailableIaps() - using cached IAP list, list contains %d IAP(s)", |
|
1280 list->Count() ); |
|
1281 |
|
1282 for( TInt idx( 0 ); idx < list->Count() && tmp.count < KWlmMaxAvailableIaps; ++idx ) |
|
1283 { |
|
1284 DEBUG2( "CWlmServer::GetAvailableIaps() - IAP %u is available, RCPI is %u", |
|
1285 (*list)[idx].iapId, (*list)[idx].rcpi ); |
|
1286 tmp.iaps[tmp.count++] = (*list)[idx]; |
|
1287 } |
|
1288 } |
|
1289 |
1266 TPckg<TWlmAvailableIaps> outPckg( tmp ); |
1290 TPckg<TWlmAvailableIaps> outPckg( tmp ); |
1267 aMessage.Write( 0, outPckg ); |
1291 aMessage.Write( 0, outPckg ); |
1268 aMessage.Complete( KErrNone ); |
1292 aMessage.Complete( KErrNone ); |
1269 iapList.Close(); |
1293 iapList.Close(); |
1270 |
1294 |
1367 mapEntry.iMessage = aMessage; |
1392 mapEntry.iMessage = aMessage; |
1368 mapEntry.iFunction = EGetAvailableIaps; |
1393 mapEntry.iFunction = EGetAvailableIaps; |
1369 mapEntry.iRequestId = iRequestIdCounter++; |
1394 mapEntry.iRequestId = iRequestIdCounter++; |
1370 mapEntry.iSessionId = aSessionId; |
1395 mapEntry.iSessionId = aSessionId; |
1371 mapEntry.iParam0 = iapDataList; |
1396 mapEntry.iParam0 = iapDataList; |
1372 mapEntry.iParam1 = iapIdList; |
1397 mapEntry.iParam1 = iapAvailabilityList; |
1373 mapEntry.iParam2 = scanList; |
1398 mapEntry.iParam2 = scanList; |
1374 mapEntry.iParam3 = iapSsidList; |
1399 mapEntry.iParam3 = iapSsidList; |
|
1400 mapEntry.iParam4 = reinterpret_cast<TAny*>( isFiltered ); |
1375 mapEntry.iTime = scanTime; |
1401 mapEntry.iTime = scanTime; |
1376 iRequestMap.Append( mapEntry ); |
1402 iRequestMap.Append( mapEntry ); |
1377 |
1403 |
1378 // Scan scheduling timer needs to be set again if this request needs the results earlier or |
1404 // Scan scheduling timer needs to be set again if this request needs the results earlier or |
1379 // if this is the only timed pending request |
1405 // if this is the only timed pending request |
1630 // CWlmServer::NotifyBackgroundScanDone |
1657 // CWlmServer::NotifyBackgroundScanDone |
1631 // --------------------------------------------------------- |
1658 // --------------------------------------------------------- |
1632 // |
1659 // |
1633 void CWlmServer::NotifyBackgroundScanDone( |
1660 void CWlmServer::NotifyBackgroundScanDone( |
1634 ScanList* aScanList, |
1661 ScanList* aScanList, |
1635 core_type_list_c<u32_t>* aIapIdList ) |
1662 core_type_list_c<core_iap_availability_data_s>& aIapAvailabilityData ) |
1636 { |
1663 { |
1637 DEBUG( "CWlmServer::NotifyBackgroundScanDone()" ); |
1664 DEBUG( "CWlmServer::NotifyBackgroundScanDone()" ); |
1638 ASSERT( aScanList != NULL ); |
1665 ASSERT( aScanList != NULL ); |
1639 ASSERT( aIapIdList != NULL ); |
1666 |
1640 |
|
1641 // Unload the drivers immediately to conserve power. |
1667 // Unload the drivers immediately to conserve power. |
1642 if( !iPlatform->IsWlanDisabled() && |
1668 if( !iPlatform->IsWlanDisabled() && |
1643 iConnectionState == EWlanStateNotConnected ) |
1669 iConnectionState == EWlanStateNotConnected ) |
1644 { |
1670 { |
1645 iCoreServer->unload_drivers(); |
1671 iCoreServer->unload_drivers(); |
1880 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficModeChanged<ind>" ); |
1907 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficModeChanged<ind>" ); |
1881 break; |
1908 break; |
1882 case EWlmNotifyAcTrafficStatusChanged: |
1909 case EWlmNotifyAcTrafficStatusChanged: |
1883 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficStatusChanged<ind>" ); |
1910 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficStatusChanged<ind>" ); |
1884 break; |
1911 break; |
|
1912 case EWlmNotifyRcpChanged: |
|
1913 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyRcpChanged<ind>" ); |
|
1914 if( static_cast<core_rcp_class_e>( data[0] ) == core_rcp_normal ) |
|
1915 { |
|
1916 TInt idx = iIapWeakList.Find( iConnectionIapId ); |
|
1917 if( idx >= 0 ) |
|
1918 { |
|
1919 DEBUG1( "CWlmServer::notify() - removing IAP %u from weak list", |
|
1920 iConnectionIapId ); |
|
1921 iIapWeakList.Remove( idx ); |
|
1922 } |
|
1923 } |
|
1924 else |
|
1925 { |
|
1926 TInt idx = iIapWeakList.Find( iConnectionIapId ); |
|
1927 if( idx == KErrNotFound ) |
|
1928 { |
|
1929 DEBUG1( "CWlmServer::notify() - adding IAP %u to weak list", |
|
1930 iConnectionIapId ); |
|
1931 iIapWeakList.Append( iConnectionIapId ); |
|
1932 } |
|
1933 } |
|
1934 break; |
1885 default: |
1935 default: |
1886 break; |
1936 break; |
1887 } |
1937 } |
1888 } |
1938 } |
1889 |
1939 |
2772 case EGetAvailableIaps: |
2821 case EGetAvailableIaps: |
2773 { |
2822 { |
2774 // Create pointers to parameters |
2823 // Create pointers to parameters |
2775 core_type_list_c<core_ssid_entry_s>* iapSsidList; |
2824 core_type_list_c<core_ssid_entry_s>* iapSsidList; |
2776 ScanList* scanList; |
2825 ScanList* scanList; |
2777 core_type_list_c<u32_t>* coreIdList; |
2826 core_type_list_c<core_iap_availability_data_s>* coreAvailabilityList; |
2778 core_type_list_c<core_iap_data_s>* iapDataList; |
2827 core_type_list_c<core_iap_data_s>* iapDataList; |
|
2828 TBool isFiltered( reinterpret_cast<TBool>( aRequest.iParam4 ) ); |
|
2829 DEBUG1( "CWlmServer::CompleteExternalRequest() - isFiltered: %u", |
|
2830 isFiltered ); |
2779 |
2831 |
2780 iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( aRequest.iParam3 ); |
2832 iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( aRequest.iParam3 ); |
2781 iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( aRequest.iParam0 ); |
2833 iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( aRequest.iParam0 ); |
2782 |
2834 |
2783 TUint* completedScanTime = reinterpret_cast<TUint*>( aRequest.iTime ); |
2835 TUint* completedScanTime = reinterpret_cast<TUint*>( aRequest.iTime ); |
2784 ScanList* completedScanList = reinterpret_cast<ScanList*>( aRequest.iParam2); |
2836 ScanList* completedScanList = reinterpret_cast<ScanList*>( aRequest.iParam2); |
2785 core_type_list_c<u32_t>* completedIdList = reinterpret_cast<core_type_list_c<u32_t>*>( aRequest.iParam1 ); |
2837 core_type_list_c<core_iap_availability_data_s>* completedAvailabilityList = |
|
2838 reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( aRequest.iParam1 ); |
2786 |
2839 |
2787 if( aTriggerRequest == NULL ) |
2840 if( aTriggerRequest == NULL ) |
2788 { |
2841 { |
2789 DEBUG( "CWlmServer::CompleteExternalRequest() - GetAvailableIaps request handled by core" ); |
2842 DEBUG( "CWlmServer::CompleteExternalRequest() - GetAvailableIaps request handled by core" ); |
2790 |
2843 |
2791 scanList = reinterpret_cast<ScanList*>( aRequest.iParam2); |
2844 scanList = reinterpret_cast<ScanList*>( aRequest.iParam2); |
2792 coreIdList = reinterpret_cast<core_type_list_c<u32_t>*>( aRequest.iParam1 ); |
2845 coreAvailabilityList = reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( aRequest.iParam1 ); |
2793 } |
2846 } |
2794 else |
2847 else |
2795 { |
2848 { |
2796 DEBUG( "CWlmServer::CompleteExternalRequest() - GetAvailableIaps request not handled by core" ); |
2849 DEBUG( "CWlmServer::CompleteExternalRequest() - GetAvailableIaps request not handled by core" ); |
2797 //Use the results of the triggering request to complete also this other request |
2850 //Use the results of the triggering request to complete also this other request |
2798 scanList = reinterpret_cast<ScanList*>( aTriggerRequest->iParam2); |
2851 scanList = reinterpret_cast<ScanList*>( aTriggerRequest->iParam2); |
2799 coreIdList = reinterpret_cast<core_type_list_c<u32_t>*>( aTriggerRequest->iParam1 ); |
2852 coreAvailabilityList = reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( aTriggerRequest->iParam1 ); |
2800 } |
2853 } |
2801 |
2854 |
2802 delete iapSsidList; |
2855 delete iapSsidList; |
2803 iapSsidList = NULL; |
2856 iapSsidList = NULL; |
2804 delete iapDataList; |
2857 delete iapDataList; |
2814 TBool lostIaps( EFalse ); |
2867 TBool lostIaps( EFalse ); |
2815 |
2868 |
2816 if( aTriggerRequest == NULL ) |
2869 if( aTriggerRequest == NULL ) |
2817 { |
2870 { |
2818 iCache->UpdateAvailableNetworksList( |
2871 iCache->UpdateAvailableNetworksList( |
2819 *coreIdList, |
2872 *coreAvailabilityList, |
2820 networkList, |
2873 networkList, |
2821 newIaps, |
2874 newIaps, |
2822 lostIaps ); |
2875 lostIaps ); |
2823 } |
2876 } |
2824 networkList.Close(); |
2877 networkList.Close(); |
2825 |
2878 |
2826 TWlmAvailableIaps tmp; |
2879 TWlmAvailableIaps tmp = { 0 }; |
2827 TUint32* pInt = coreIdList->first(); |
2880 core_iap_availability_data_s* pInt = coreAvailabilityList->first(); |
2828 TInt idx = 0; |
2881 if( isFiltered ) |
2829 while( pInt ) |
|
2830 { |
2882 { |
2831 DEBUG1( "CWlmServer::CompleteExternalRequest() - IAP %u is available", |
2883 while( pInt && tmp.count < KWlmMaxAvailableIaps ) |
2832 *pInt ); |
2884 { |
2833 tmp.iaps[ idx ] = *pInt; |
2885 if( pInt->rcpi < iDeviceSettings.minRcpiForIapAvailability ) |
2834 idx++; |
2886 { |
2835 pInt = coreIdList->next(); |
2887 DEBUG3( "CWlmServer::CompleteExternalRequest() - IAP %u filtered, RCPI is too weak (%u vs %u)", |
|
2888 pInt->id, pInt->rcpi, iDeviceSettings.minRcpiForIapAvailability ); |
|
2889 } |
|
2890 else if( iIapWeakList.Find( pInt->id ) != KErrNotFound ) |
|
2891 { |
|
2892 if( pInt->rcpi < iDeviceSettings.rcpiTrigger ) |
|
2893 { |
|
2894 DEBUG3( "CWlmServer::CompleteExternalRequest() - IAP %u filtered, in weak list and RCPI is too weak (%u vs %u)", |
|
2895 pInt->id, pInt->rcpi, iDeviceSettings.rcpiTrigger ); |
|
2896 } |
|
2897 else |
|
2898 { |
|
2899 DEBUG2( "CWlmServer::CompleteExternalRequest() - IAP %u is available, RCPI is %u, removed from weak list", |
|
2900 pInt->id, pInt->rcpi ); |
|
2901 tmp.iaps[tmp.count].iapId = pInt->id; |
|
2902 tmp.iaps[tmp.count++].rcpi = pInt->rcpi; |
|
2903 iIapWeakList.Remove( |
|
2904 iIapWeakList.Find( pInt->id ) ); |
|
2905 } |
|
2906 } |
|
2907 else |
|
2908 { |
|
2909 DEBUG2( "CWlmServer::CompleteExternalRequest() - IAP %u is available, RCPI is %u", |
|
2910 pInt->id, pInt->rcpi ); |
|
2911 tmp.iaps[tmp.count].iapId = pInt->id; |
|
2912 tmp.iaps[tmp.count++].rcpi = pInt->rcpi; |
|
2913 } |
|
2914 pInt = coreAvailabilityList->next(); |
|
2915 } |
2836 } |
2916 } |
2837 |
2917 else |
2838 tmp.count = idx; |
2918 { |
2839 |
2919 while( pInt && tmp.count < KWlmMaxAvailableIaps ) |
|
2920 { |
|
2921 if( pInt->rcpi >= iDeviceSettings.rcpiTrigger && |
|
2922 iIapWeakList.Find( pInt->id ) != KErrNotFound ) |
|
2923 { |
|
2924 DEBUG2( "CWlmServer::CompleteExternalRequest() - IAP %u is available, RCPI is %u, removed from weak list", |
|
2925 pInt->id, pInt->rcpi ); |
|
2926 iIapWeakList.Remove( |
|
2927 iIapWeakList.Find( pInt->id ) ); |
|
2928 } |
|
2929 else |
|
2930 { |
|
2931 DEBUG2( "CWlmServer::CompleteExternalRequest() - IAP %u is available, RCPI is %u", |
|
2932 pInt->id, pInt->rcpi ); |
|
2933 } |
|
2934 |
|
2935 tmp.iaps[tmp.count].iapId = pInt->id; |
|
2936 tmp.iaps[tmp.count++].rcpi = pInt->rcpi; |
|
2937 pInt = coreAvailabilityList->next(); |
|
2938 } |
|
2939 } |
|
2940 |
2840 if( IsSessionActive( aRequest ) ) |
2941 if( IsSessionActive( aRequest ) ) |
2841 { |
2942 { |
2842 TPckg<TWlmAvailableIaps> outPckg( tmp ); |
2943 TPckg<TWlmAvailableIaps> outPckg( tmp ); |
2843 aRequest.iMessage.Write( 0, outPckg ); |
2944 aRequest.iMessage.Write( 0, outPckg ); |
2844 } |
2945 } |
2845 if( aTriggerRequest == NULL ) |
2946 if( aTriggerRequest == NULL ) |
2846 { |
2947 { |
2847 DEBUG("CWlmServer::CompleteExternalRequest() - delete iapIdList" ); |
2948 DEBUG("CWlmServer::CompleteExternalRequest() - delete coreAvailabilityList" ); |
2848 delete coreIdList; |
2949 delete coreAvailabilityList; |
2849 } |
2950 } |
2850 else |
2951 else |
2851 { |
2952 { |
2852 // If this completed request was not the triggering request then there is no need |
2953 // If this completed request was not the triggering request then there is no need |
2853 // to cache anything. The triggering request results will be cached. |
2954 // to cache anything. The triggering request results will be cached. |
2854 delete completedIdList; |
2955 delete completedAvailabilityList; |
2855 delete completedScanList; |
2956 delete completedScanList; |
2856 } |
2957 } |
2857 |
2958 |
2858 // handle scan list |
2959 // handle scan list |
2859 if( aTriggerRequest == NULL ) |
2960 if( aTriggerRequest == NULL ) |
3009 ieLength <= KMaxSSIDLength ) |
3110 ieLength <= KMaxSSIDLength ) |
3010 { |
3111 { |
3011 TWlanAvailableNetwork network; |
3112 TWlanAvailableNetwork network; |
3012 network.ssid.Copy( ieData, ieLength ); |
3113 network.ssid.Copy( ieData, ieLength ); |
3013 network.securityMode = info.SecurityMode(); |
3114 network.securityMode = info.SecurityMode(); |
|
3115 network.rcpi = info.RXLevel(); |
3014 if( info.OperatingMode() == WlanOperatingModeInfra ) |
3116 if( info.OperatingMode() == WlanOperatingModeInfra ) |
3015 { |
3117 { |
3016 network.networkType = Infrastructure; |
3118 network.networkType = Infrastructure; |
3017 } |
3119 } |
3018 else |
3120 else |
3019 { |
3121 { |
3020 network.networkType = Adhoc; |
3122 network.networkType = Adhoc; |
3021 } |
3123 } |
3022 |
3124 |
3023 if ( aNetworkList.Find( network, isEqual ) == KErrNotFound ) |
3125 TInt idx = aNetworkList.Find( network, isEqual ); |
|
3126 if ( idx == KErrNotFound ) |
3024 { |
3127 { |
3025 DEBUG1S( "CWlmServer::GetNetworkList() - appending SSID ", |
3128 DEBUG1S( "CWlmServer::GetNetworkList() - appending SSID ", |
3026 ieLength, ieData ); |
3129 ieLength, ieData ); |
3027 aNetworkList.Append( network ); |
3130 aNetworkList.Append( network ); |
|
3131 } |
|
3132 else if( idx >= 0 && |
|
3133 aNetworkList[idx].rcpi < network.rcpi ) |
|
3134 { |
|
3135 aNetworkList[idx].rcpi = network.rcpi; |
3028 } |
3136 } |
3029 } |
3137 } |
3030 } |
3138 } |
3031 |
3139 |
3032 return KErrNone; |
3140 return KErrNone; |
3444 { |
3553 { |
3445 DEBUG( "CWlmServer::BackgroundScanRequest() - unable to instantiate TUint" ); |
3554 DEBUG( "CWlmServer::BackgroundScanRequest() - unable to instantiate TUint" ); |
3446 |
3555 |
3447 delete iapDataList; |
3556 delete iapDataList; |
3448 delete iapSsidList; |
3557 delete iapSsidList; |
3449 delete iapIdList; |
3558 delete iapAvailabilityList; |
3450 delete scanList; |
3559 delete scanList; |
3451 return KErrNoMemory; |
3560 return KErrNoMemory; |
3452 } |
3561 } |
3453 |
3562 |
3454 // create mapping |
3563 // create mapping |
3455 SRequestMapEntry mapEntry; |
3564 SRequestMapEntry mapEntry; |
3456 mapEntry.iFunction = EGetAvailableIaps; |
3565 mapEntry.iFunction = EGetAvailableIaps; |
3457 mapEntry.iRequestId = KWlanIntCmdBackgroundScan; |
3566 mapEntry.iRequestId = KWlanIntCmdBackgroundScan; |
3458 mapEntry.iSessionId = 0; |
3567 mapEntry.iSessionId = 0; |
3459 mapEntry.iParam0 = iapDataList; |
3568 mapEntry.iParam0 = iapDataList; |
3460 mapEntry.iParam1 = iapIdList; |
3569 mapEntry.iParam1 = iapAvailabilityList; |
3461 mapEntry.iParam2 = scanList; |
3570 mapEntry.iParam2 = scanList; |
3462 mapEntry.iParam3 = iapSsidList; |
3571 mapEntry.iParam3 = iapSsidList; |
|
3572 mapEntry.iParam4 = reinterpret_cast<TAny*>( EFalse ); |
3463 mapEntry.iTime = scanTime; |
3573 mapEntry.iTime = scanTime; |
3464 iRequestMap.Append( mapEntry ); |
3574 iRequestMap.Append( mapEntry ); |
3465 |
3575 |
3466 if( IsOnlyTimedScanRequestInRequestMap( mapEntry ) || *scanTime < iScanSchedulingTimerExpiration ) |
3576 if( IsOnlyTimedScanRequestInRequestMap( mapEntry ) || *scanTime < iScanSchedulingTimerExpiration ) |
3467 { |
3577 { |
3468 // Scan scheduling timer needs to be set again because this request needs the results earlier |
3578 // Scan scheduling timer needs to be set again because this request needs the results earlier |
3469 UpdateScanSchedulingTimer( *scanTime, mapEntry.iRequestId ); |
3579 UpdateScanSchedulingTimer( *scanTime, mapEntry.iRequestId ); |
3470 } |
3580 } |
3556 self->iRequestMap[index].iFunction == EGetAvailableIaps ) |
3666 self->iRequestMap[index].iFunction == EGetAvailableIaps ) |
3557 { |
3667 { |
3558 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - GetAvailableIaps requested" ); |
3668 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - GetAvailableIaps requested" ); |
3559 |
3669 |
3560 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3670 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3561 core_type_list_c<u32_t>* iapIdList = reinterpret_cast<core_type_list_c<u32_t>*>( self->iRequestMap[index].iParam1 ); |
3671 core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList = |
|
3672 reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( self->iRequestMap[index].iParam1 ); |
3562 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3673 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3563 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3674 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3564 TUint* scanTime = reinterpret_cast<TUint*>( self->iRequestMap[index].iTime ); |
3675 TUint* scanTime = reinterpret_cast<TUint*>( self->iRequestMap[index].iTime ); |
3565 |
3676 |
3566 // If the device is roaming OR there are not WLAN IAPs defined in the device |
3677 // If the device is roaming OR there are not WLAN IAPs defined in the device |
3627 { |
3738 { |
3628 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - starting background scan, cancel timer" ); |
3739 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - starting background scan, cancel timer" ); |
3629 // pass request to core |
3740 // pass request to core |
3630 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3741 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3631 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3742 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3632 core_type_list_c<u32_t>* iapIdList = reinterpret_cast<core_type_list_c<u32_t>*>( self->iRequestMap[index].iParam1 ); |
3743 core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList = |
|
3744 reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( self->iRequestMap[index].iParam1 ); |
3633 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3745 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3634 |
3746 |
3635 self->iCoreServer->get_available_iaps( |
3747 self->iCoreServer->get_available_iaps( |
3636 self->iRequestMap[index].iRequestId, |
3748 self->iRequestMap[index].iRequestId, |
3637 isActiveScanAllowed, |
3749 isActiveScanAllowed, |
3638 *iapDataList, |
3750 *iapDataList, |
3639 *iapIdList, |
3751 *iapAvailabilityList, |
3640 iapSsidList, |
3752 iapSsidList, |
3641 *scanList ); |
3753 *scanList ); |
3642 |
3754 |
3643 self->iScanSchedulingTimer->Cancel(); |
3755 self->iScanSchedulingTimer->Cancel(); |
3644 } |
3756 } |
3666 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - starting GetAvailableIaps, cancel timer" ); |
3778 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - starting GetAvailableIaps, cancel timer" ); |
3667 |
3779 |
3668 // pass request to core |
3780 // pass request to core |
3669 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3781 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3670 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3782 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3671 core_type_list_c<u32_t>* iapIdList = reinterpret_cast<core_type_list_c<u32_t>*>( self->iRequestMap[index].iParam1 ); |
3783 core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList = |
|
3784 reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( self->iRequestMap[index].iParam1 ); |
3672 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3785 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3673 |
3786 |
3674 self->iCoreServer->get_available_iaps( |
3787 self->iCoreServer->get_available_iaps( |
3675 self->iRequestMap[index].iRequestId, |
3788 self->iRequestMap[index].iRequestId, |
3676 isActiveScanAllowed, |
3789 isActiveScanAllowed, |
3677 *iapDataList, |
3790 *iapDataList, |
3678 *iapIdList, |
3791 *iapAvailabilityList, |
3679 iapSsidList, |
3792 iapSsidList, |
3680 *scanList ); |
3793 *scanList ); |
3681 |
3794 |
3682 self->iScanSchedulingTimer->Cancel(); |
3795 self->iScanSchedulingTimer->Cancel(); |
3683 } |
3796 } |
4075 iScanSchedulingTimer->Cancel(); |
4188 iScanSchedulingTimer->Cancel(); |
4076 |
4189 |
4077 DEBUG( "CWlmServer::CancelScan() - remove entry from request map" ); |
4190 DEBUG( "CWlmServer::CancelScan() - remove entry from request map" ); |
4078 SRequestMapEntry entry = iRequestMap[index]; |
4191 SRequestMapEntry entry = iRequestMap[index]; |
4079 delete reinterpret_cast<core_type_list_c<core_iap_data_s>*>( entry.iParam0 ); |
4192 delete reinterpret_cast<core_type_list_c<core_iap_data_s>*>( entry.iParam0 ); |
4080 delete reinterpret_cast<core_type_list_c<u32_t>*>( entry.iParam1 ); |
4193 delete reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( entry.iParam1 ); |
4081 delete reinterpret_cast<ScanList*>( entry.iParam2); |
4194 delete reinterpret_cast<ScanList*>( entry.iParam2); |
4082 delete reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( entry.iParam3 ); |
4195 delete reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( entry.iParam3 ); |
4083 delete reinterpret_cast<TUint*>( entry.iTime ); |
4196 delete reinterpret_cast<TUint*>( entry.iTime ); |
4084 iRequestMap.Remove( index ); |
4197 iRequestMap.Remove( index ); |
4085 |
4198 |
4112 DEBUG( "CWlmServer::CancelScan() - just remove the entry from the request map" ); |
4225 DEBUG( "CWlmServer::CancelScan() - just remove the entry from the request map" ); |
4113 |
4226 |
4114 DEBUG( "CWlmServer::CancelScan() - remove entry from request map" ); |
4227 DEBUG( "CWlmServer::CancelScan() - remove entry from request map" ); |
4115 SRequestMapEntry entry = iRequestMap[index]; |
4228 SRequestMapEntry entry = iRequestMap[index]; |
4116 delete reinterpret_cast<core_type_list_c<core_iap_data_s>*>( entry.iParam0 ); |
4229 delete reinterpret_cast<core_type_list_c<core_iap_data_s>*>( entry.iParam0 ); |
4117 delete reinterpret_cast<core_type_list_c<u32_t>*>( entry.iParam1 ); |
4230 delete reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( entry.iParam1 ); |
4118 delete reinterpret_cast<ScanList*>( entry.iParam2); |
4231 delete reinterpret_cast<ScanList*>( entry.iParam2); |
4119 delete reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( entry.iParam3 ); |
4232 delete reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( entry.iParam3 ); |
4120 delete reinterpret_cast<TUint*>( entry.iTime ); |
4233 delete reinterpret_cast<TUint*>( entry.iTime ); |
4121 iRequestMap.Remove( index ); |
4234 iRequestMap.Remove( index ); |
4122 } |
4235 } |
5014 { |
5127 { |
5015 DEBUG( "CWlmServer::HandleSsidListAvailabilityL()" ); |
5128 DEBUG( "CWlmServer::HandleSsidListAvailabilityL()" ); |
5016 |
5129 |
5017 ScanList* scanList = |
5130 ScanList* scanList = |
5018 reinterpret_cast<ScanList*>( aMapEntry.iParam2 ); |
5131 reinterpret_cast<ScanList*>( aMapEntry.iParam2 ); |
5019 core_type_list_c<u32_t>* iapIdList = |
5132 core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList = |
5020 reinterpret_cast<core_type_list_c<u32_t>*>( aMapEntry.iParam1 ); |
5133 reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( aMapEntry.iParam1 ); |
5021 |
5134 |
5022 /** |
5135 /** |
5023 * Go through the IAP list and find IAPs that haven't been found |
5136 * Go through the IAP list and find IAPs that haven't been found |
5024 * during GetAvailableIaps and have an SSID list attached. |
5137 * during GetAvailableIaps and have an SSID list attached. |
5025 */ |
5138 */ |
5026 RArray<TWlanLimitedIapData> attachedIapList; |
5139 RArray<TWlanLimitedIapData> attachedIapList; |
5027 CleanupClosePushL( attachedIapList ); |
5140 CleanupClosePushL( attachedIapList ); |
5028 const RArray<TWlanLimitedIapData>& cachedIapList( |
5141 const RArray<TWlanLimitedIapData>& cachedIapList( |
5029 iCache->CachedIapDataList() ); |
5142 iCache->CachedIapDataList() ); |
5030 core_type_list_iterator_c<u32_t> iter( *iapIdList ); |
5143 core_type_list_iterator_c<core_iap_availability_data_s> iter( *iapAvailabilityList ); |
5031 for( TInt idx( 0 ); idx < cachedIapList.Count(); ++idx ) |
5144 for( TInt idx( 0 ); idx < cachedIapList.Count(); ++idx ) |
5032 { |
5145 { |
5033 TBool isFound( EFalse ); |
5146 TBool isFound( EFalse ); |
5034 for( u32_t* item = iter.first(); !isFound && item; item = iter.next() ) |
5147 for( core_iap_availability_data_s* item = iter.first(); !isFound && item; item = iter.next() ) |
5035 { |
5148 { |
5036 if( *item == cachedIapList[idx].iapId ) |
5149 if( item->id == cachedIapList[idx].iapId ) |
5037 { |
5150 { |
5038 isFound = ETrue; |
5151 isFound = ETrue; |
5039 } |
5152 } |
5040 } |
5153 } |
5041 if( !isFound ) |
5154 if( !isFound ) |