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 ); |
1221 DEBUG( "CWlmServer::GetAvailableIaps()" ); |
1222 DEBUG( "CWlmServer::GetAvailableIaps()" ); |
1222 |
1223 |
1223 // Read cacheLifetime and maxDelay arguments |
1224 // Read cacheLifetime and maxDelay arguments |
1224 TPckgBuf<TInt> cacheLifetimePckg( KWlmDefaultScanCacheLifetime ); |
1225 TPckgBuf<TInt> cacheLifetimePckg( KWlmDefaultScanCacheLifetime ); |
1225 TPckgBuf<TUint> maxDelayPckg( 0 ); |
1226 TPckgBuf<TUint> maxDelayPckg( 0 ); |
|
1227 TBool isFiltered( |
|
1228 aMessage.Int3() ); |
|
1229 DEBUG1( "CWlmServer::GetAvailableIaps() - isFiltered: %u", |
|
1230 isFiltered ); |
1226 if( aMessage.Read( 1, cacheLifetimePckg ) != KErrNone ) |
1231 if( aMessage.Read( 1, cacheLifetimePckg ) != KErrNone ) |
1227 { |
1232 { |
1228 DEBUG( "CWlmServer::GetAvailableIaps() - unable to read lifetime parameter" ); |
1233 DEBUG( "CWlmServer::GetAvailableIaps() - unable to read lifetime parameter" ); |
1229 |
1234 |
1230 aMessage.Complete( KErrArgument ); |
1235 aMessage.Complete( KErrArgument ); |
1252 |
1257 |
1253 /** |
1258 /** |
1254 * See if cached IAP availability information is available. |
1259 * See if cached IAP availability information is available. |
1255 */ |
1260 */ |
1256 RArray<TWlanLimitedIapData> iapList; |
1261 RArray<TWlanLimitedIapData> iapList; |
1257 RArray<TUint>* list = iCache->AvailableIaps( |
1262 RArray<TWlmAvailabilityData>* list = iCache->AvailableIaps( |
1258 iapList, |
1263 iapList, |
1259 ( cacheLifetimePckg() == 0 ? 1 : cacheLifetimePckg() ) ); |
1264 ( cacheLifetimePckg() == 0 ? 1 : cacheLifetimePckg() ) ); |
1260 |
|
1261 // Only complete with valid cache if maxDelay is zero |
1265 // Only complete with valid cache if maxDelay is zero |
1262 if( list && maxDelayPckg() == 0 ) |
1266 if( list && maxDelayPckg() == 0 ) |
1263 { |
1267 { |
1264 |
1268 TWlmAvailableIaps tmp = { 0 }; |
1265 TWlmAvailableIaps tmp; |
1269 if( isFiltered ) |
1266 const TInt listCount( |
1270 { |
1267 Min( list->Count(), KWlmMaxAvailableIaps ) ); |
1271 DEBUG1( "CWlmServer::GetAvailableIaps() - using filtered cached IAP list, list contains %d IAP(s)", |
1268 |
1272 list->Count() ); |
1269 DEBUG1( "CWlmServer::GetAvailableIaps() - using cached IAP list, list contains %d IAP(s)", listCount ); |
1273 |
1270 |
1274 for( TInt idx( 0 ); idx < list->Count() && tmp.count < KWlmMaxAvailableIaps; ++idx ) |
1271 TInt listIdx( 0 ); |
1275 { |
1272 |
1276 if( (*list)[idx].rcpi >= iDeviceSettings.minRcpiForIapAvailability && |
1273 while( listIdx < listCount ) |
1277 iIapWeakList.Find( (*list)[idx].iapId ) == KErrNotFound ) |
1274 { |
1278 { |
1275 tmp.iaps[ listIdx ] = (*list)[listIdx]; |
1279 DEBUG2( "CWlmServer::GetAvailableIaps() - IAP %u is available, RCPI is %u", |
1276 ++listIdx; |
1280 (*list)[idx].iapId, (*list)[idx].rcpi ); |
1277 } |
1281 tmp.iaps[tmp.count++] = (*list)[idx]; |
1278 tmp.count = listCount; |
1282 } |
|
1283 else |
|
1284 { |
|
1285 DEBUG2( "CWlmServer::GetAvailableIaps() - IAP %u filtered, RCPI is %u", |
|
1286 (*list)[idx].iapId, (*list)[idx].rcpi ); |
|
1287 } |
|
1288 } |
|
1289 } |
|
1290 else |
|
1291 { |
|
1292 DEBUG1( "CWlmServer::GetAvailableIaps() - using cached IAP list, list contains %d IAP(s)", |
|
1293 list->Count() ); |
|
1294 |
|
1295 for( TInt idx( 0 ); idx < list->Count() && tmp.count < KWlmMaxAvailableIaps; ++idx ) |
|
1296 { |
|
1297 DEBUG2( "CWlmServer::GetAvailableIaps() - IAP %u is available, RCPI is %u", |
|
1298 (*list)[idx].iapId, (*list)[idx].rcpi ); |
|
1299 tmp.iaps[tmp.count++] = (*list)[idx]; |
|
1300 } |
|
1301 } |
|
1302 |
1279 TPckg<TWlmAvailableIaps> outPckg( tmp ); |
1303 TPckg<TWlmAvailableIaps> outPckg( tmp ); |
1280 aMessage.Write( 0, outPckg ); |
1304 aMessage.Write( 0, outPckg ); |
1281 aMessage.Complete( KErrNone ); |
1305 aMessage.Complete( KErrNone ); |
1282 iapList.Close(); |
1306 iapList.Close(); |
1283 |
1307 |
1380 mapEntry.iMessage = aMessage; |
1405 mapEntry.iMessage = aMessage; |
1381 mapEntry.iFunction = EGetAvailableIaps; |
1406 mapEntry.iFunction = EGetAvailableIaps; |
1382 mapEntry.iRequestId = iRequestIdCounter++; |
1407 mapEntry.iRequestId = iRequestIdCounter++; |
1383 mapEntry.iSessionId = aSessionId; |
1408 mapEntry.iSessionId = aSessionId; |
1384 mapEntry.iParam0 = iapDataList; |
1409 mapEntry.iParam0 = iapDataList; |
1385 mapEntry.iParam1 = iapIdList; |
1410 mapEntry.iParam1 = iapAvailabilityList; |
1386 mapEntry.iParam2 = scanList; |
1411 mapEntry.iParam2 = scanList; |
1387 mapEntry.iParam3 = iapSsidList; |
1412 mapEntry.iParam3 = iapSsidList; |
|
1413 mapEntry.iParam4 = reinterpret_cast<TAny*>( isFiltered ); |
1388 mapEntry.iTime = scanTime; |
1414 mapEntry.iTime = scanTime; |
1389 iRequestMap.Append( mapEntry ); |
1415 iRequestMap.Append( mapEntry ); |
1390 |
1416 |
1391 // Scan scheduling timer needs to be set again if this request needs the results earlier or |
1417 // Scan scheduling timer needs to be set again if this request needs the results earlier or |
1392 // if this is the only timed pending request |
1418 // if this is the only timed pending request |
1643 // CWlmServer::NotifyBackgroundScanDone |
1670 // CWlmServer::NotifyBackgroundScanDone |
1644 // --------------------------------------------------------- |
1671 // --------------------------------------------------------- |
1645 // |
1672 // |
1646 void CWlmServer::NotifyBackgroundScanDone( |
1673 void CWlmServer::NotifyBackgroundScanDone( |
1647 ScanList* aScanList, |
1674 ScanList* aScanList, |
1648 core_type_list_c<u32_t>* aIapIdList ) |
1675 core_type_list_c<core_iap_availability_data_s>& aIapAvailabilityData ) |
1649 { |
1676 { |
1650 DEBUG( "CWlmServer::NotifyBackgroundScanDone()" ); |
1677 DEBUG( "CWlmServer::NotifyBackgroundScanDone()" ); |
1651 ASSERT( aScanList != NULL ); |
1678 ASSERT( aScanList != NULL ); |
1652 ASSERT( aIapIdList != NULL ); |
1679 |
1653 |
|
1654 // Unload the drivers immediately to conserve power. |
1680 // Unload the drivers immediately to conserve power. |
1655 if( !iPlatform->IsWlanDisabled() && |
1681 if( !iPlatform->IsWlanDisabled() && |
1656 iConnectionState == EWlanStateNotConnected ) |
1682 iConnectionState == EWlanStateNotConnected ) |
1657 { |
1683 { |
1658 iCoreServer->unload_drivers(); |
1684 iCoreServer->unload_drivers(); |
1895 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficModeChanged<ind>" ); |
1922 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficModeChanged<ind>" ); |
1896 break; |
1923 break; |
1897 case EWlmNotifyAcTrafficStatusChanged: |
1924 case EWlmNotifyAcTrafficStatusChanged: |
1898 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficStatusChanged<ind>" ); |
1925 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficStatusChanged<ind>" ); |
1899 break; |
1926 break; |
|
1927 case EWlmNotifyRcpChanged: |
|
1928 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyRcpChanged<ind>" ); |
|
1929 if( static_cast<core_rcp_class_e>( data[0] ) == core_rcp_normal ) |
|
1930 { |
|
1931 TInt idx = iIapWeakList.Find( iConnectionIapId ); |
|
1932 if( idx >= 0 ) |
|
1933 { |
|
1934 DEBUG1( "CWlmServer::notify() - removing IAP %u from weak list", |
|
1935 iConnectionIapId ); |
|
1936 iIapWeakList.Remove( idx ); |
|
1937 } |
|
1938 } |
|
1939 else |
|
1940 { |
|
1941 TInt idx = iIapWeakList.Find( iConnectionIapId ); |
|
1942 if( idx == KErrNotFound ) |
|
1943 { |
|
1944 DEBUG1( "CWlmServer::notify() - adding IAP %u to weak list", |
|
1945 iConnectionIapId ); |
|
1946 iIapWeakList.Append( iConnectionIapId ); |
|
1947 } |
|
1948 } |
|
1949 break; |
1900 default: |
1950 default: |
1901 break; |
1951 break; |
1902 } |
1952 } |
1903 } |
1953 } |
1904 |
1954 |
2787 case EGetAvailableIaps: |
2836 case EGetAvailableIaps: |
2788 { |
2837 { |
2789 // Create pointers to parameters |
2838 // Create pointers to parameters |
2790 core_type_list_c<core_ssid_entry_s>* iapSsidList; |
2839 core_type_list_c<core_ssid_entry_s>* iapSsidList; |
2791 ScanList* scanList; |
2840 ScanList* scanList; |
2792 core_type_list_c<u32_t>* coreIdList; |
2841 core_type_list_c<core_iap_availability_data_s>* coreAvailabilityList; |
2793 core_type_list_c<core_iap_data_s>* iapDataList; |
2842 core_type_list_c<core_iap_data_s>* iapDataList; |
|
2843 TBool isFiltered( reinterpret_cast<TBool>( aRequest.iParam4 ) ); |
|
2844 DEBUG1( "CWlmServer::CompleteExternalRequest() - isFiltered: %u", |
|
2845 isFiltered ); |
2794 |
2846 |
2795 iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( aRequest.iParam3 ); |
2847 iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( aRequest.iParam3 ); |
2796 iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( aRequest.iParam0 ); |
2848 iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( aRequest.iParam0 ); |
2797 |
2849 |
2798 TUint* completedScanTime = reinterpret_cast<TUint*>( aRequest.iTime ); |
2850 TUint* completedScanTime = reinterpret_cast<TUint*>( aRequest.iTime ); |
2799 ScanList* completedScanList = reinterpret_cast<ScanList*>( aRequest.iParam2); |
2851 ScanList* completedScanList = reinterpret_cast<ScanList*>( aRequest.iParam2); |
2800 core_type_list_c<u32_t>* completedIdList = reinterpret_cast<core_type_list_c<u32_t>*>( aRequest.iParam1 ); |
2852 core_type_list_c<core_iap_availability_data_s>* completedAvailabilityList = |
|
2853 reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( aRequest.iParam1 ); |
2801 |
2854 |
2802 if( aTriggerRequest == NULL ) |
2855 if( aTriggerRequest == NULL ) |
2803 { |
2856 { |
2804 DEBUG( "CWlmServer::CompleteExternalRequest() - GetAvailableIaps request handled by core" ); |
2857 DEBUG( "CWlmServer::CompleteExternalRequest() - GetAvailableIaps request handled by core" ); |
2805 |
2858 |
2806 scanList = reinterpret_cast<ScanList*>( aRequest.iParam2); |
2859 scanList = reinterpret_cast<ScanList*>( aRequest.iParam2); |
2807 coreIdList = reinterpret_cast<core_type_list_c<u32_t>*>( aRequest.iParam1 ); |
2860 coreAvailabilityList = reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( aRequest.iParam1 ); |
2808 } |
2861 } |
2809 else |
2862 else |
2810 { |
2863 { |
2811 DEBUG( "CWlmServer::CompleteExternalRequest() - GetAvailableIaps request not handled by core" ); |
2864 DEBUG( "CWlmServer::CompleteExternalRequest() - GetAvailableIaps request not handled by core" ); |
2812 //Use the results of the triggering request to complete also this other request |
2865 //Use the results of the triggering request to complete also this other request |
2813 scanList = reinterpret_cast<ScanList*>( aTriggerRequest->iParam2); |
2866 scanList = reinterpret_cast<ScanList*>( aTriggerRequest->iParam2); |
2814 coreIdList = reinterpret_cast<core_type_list_c<u32_t>*>( aTriggerRequest->iParam1 ); |
2867 coreAvailabilityList = reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( aTriggerRequest->iParam1 ); |
2815 } |
2868 } |
2816 |
2869 |
2817 delete iapSsidList; |
2870 delete iapSsidList; |
2818 iapSsidList = NULL; |
2871 iapSsidList = NULL; |
2819 delete iapDataList; |
2872 delete iapDataList; |
2829 TBool lostIaps( EFalse ); |
2882 TBool lostIaps( EFalse ); |
2830 |
2883 |
2831 if( aTriggerRequest == NULL ) |
2884 if( aTriggerRequest == NULL ) |
2832 { |
2885 { |
2833 iCache->UpdateAvailableNetworksList( |
2886 iCache->UpdateAvailableNetworksList( |
2834 *coreIdList, |
2887 *coreAvailabilityList, |
2835 networkList, |
2888 networkList, |
2836 newIaps, |
2889 newIaps, |
2837 lostIaps ); |
2890 lostIaps ); |
2838 } |
2891 } |
2839 networkList.Close(); |
2892 networkList.Close(); |
2840 |
2893 |
2841 TWlmAvailableIaps tmp; |
2894 TWlmAvailableIaps tmp = { 0 }; |
2842 TUint32* pInt = coreIdList->first(); |
2895 core_iap_availability_data_s* pInt = coreAvailabilityList->first(); |
2843 TInt idx = 0; |
2896 if( isFiltered ) |
2844 while( pInt ) |
|
2845 { |
2897 { |
2846 DEBUG1( "CWlmServer::CompleteExternalRequest() - IAP %u is available", |
2898 while( pInt && tmp.count < KWlmMaxAvailableIaps ) |
2847 *pInt ); |
2899 { |
2848 tmp.iaps[ idx ] = *pInt; |
2900 if( pInt->rcpi < iDeviceSettings.minRcpiForIapAvailability ) |
2849 idx++; |
2901 { |
2850 pInt = coreIdList->next(); |
2902 DEBUG3( "CWlmServer::CompleteExternalRequest() - IAP %u filtered, RCPI is too weak (%u vs %u)", |
|
2903 pInt->id, pInt->rcpi, iDeviceSettings.minRcpiForIapAvailability ); |
|
2904 } |
|
2905 else if( iIapWeakList.Find( pInt->id ) != KErrNotFound ) |
|
2906 { |
|
2907 if( pInt->rcpi < iDeviceSettings.rcpiTrigger ) |
|
2908 { |
|
2909 DEBUG3( "CWlmServer::CompleteExternalRequest() - IAP %u filtered, in weak list and RCPI is too weak (%u vs %u)", |
|
2910 pInt->id, pInt->rcpi, iDeviceSettings.rcpiTrigger ); |
|
2911 } |
|
2912 else |
|
2913 { |
|
2914 DEBUG2( "CWlmServer::CompleteExternalRequest() - IAP %u is available, RCPI is %u, removed from weak list", |
|
2915 pInt->id, pInt->rcpi ); |
|
2916 tmp.iaps[tmp.count].iapId = pInt->id; |
|
2917 tmp.iaps[tmp.count++].rcpi = pInt->rcpi; |
|
2918 iIapWeakList.Remove( |
|
2919 iIapWeakList.Find( pInt->id ) ); |
|
2920 } |
|
2921 } |
|
2922 else |
|
2923 { |
|
2924 DEBUG2( "CWlmServer::CompleteExternalRequest() - IAP %u is available, RCPI is %u", |
|
2925 pInt->id, pInt->rcpi ); |
|
2926 tmp.iaps[tmp.count].iapId = pInt->id; |
|
2927 tmp.iaps[tmp.count++].rcpi = pInt->rcpi; |
|
2928 } |
|
2929 pInt = coreAvailabilityList->next(); |
|
2930 } |
2851 } |
2931 } |
2852 |
2932 else |
2853 tmp.count = idx; |
2933 { |
2854 |
2934 while( pInt && tmp.count < KWlmMaxAvailableIaps ) |
|
2935 { |
|
2936 if( pInt->rcpi >= iDeviceSettings.rcpiTrigger && |
|
2937 iIapWeakList.Find( pInt->id ) != KErrNotFound ) |
|
2938 { |
|
2939 DEBUG2( "CWlmServer::CompleteExternalRequest() - IAP %u is available, RCPI is %u, removed from weak list", |
|
2940 pInt->id, pInt->rcpi ); |
|
2941 iIapWeakList.Remove( |
|
2942 iIapWeakList.Find( pInt->id ) ); |
|
2943 } |
|
2944 else |
|
2945 { |
|
2946 DEBUG2( "CWlmServer::CompleteExternalRequest() - IAP %u is available, RCPI is %u", |
|
2947 pInt->id, pInt->rcpi ); |
|
2948 } |
|
2949 |
|
2950 tmp.iaps[tmp.count].iapId = pInt->id; |
|
2951 tmp.iaps[tmp.count++].rcpi = pInt->rcpi; |
|
2952 pInt = coreAvailabilityList->next(); |
|
2953 } |
|
2954 } |
|
2955 |
2855 if( IsSessionActive( aRequest ) ) |
2956 if( IsSessionActive( aRequest ) ) |
2856 { |
2957 { |
2857 TPckg<TWlmAvailableIaps> outPckg( tmp ); |
2958 TPckg<TWlmAvailableIaps> outPckg( tmp ); |
2858 aRequest.iMessage.Write( 0, outPckg ); |
2959 aRequest.iMessage.Write( 0, outPckg ); |
2859 } |
2960 } |
2860 if( aTriggerRequest == NULL ) |
2961 if( aTriggerRequest == NULL ) |
2861 { |
2962 { |
2862 DEBUG("CWlmServer::CompleteExternalRequest() - delete iapIdList" ); |
2963 DEBUG("CWlmServer::CompleteExternalRequest() - delete coreAvailabilityList" ); |
2863 delete coreIdList; |
2964 delete coreAvailabilityList; |
2864 } |
2965 } |
2865 else |
2966 else |
2866 { |
2967 { |
2867 // If this completed request was not the triggering request then there is no need |
2968 // If this completed request was not the triggering request then there is no need |
2868 // to cache anything. The triggering request results will be cached. |
2969 // to cache anything. The triggering request results will be cached. |
2869 delete completedIdList; |
2970 delete completedAvailabilityList; |
2870 delete completedScanList; |
2971 delete completedScanList; |
2871 } |
2972 } |
2872 |
2973 |
2873 // handle scan list |
2974 // handle scan list |
2874 if( aTriggerRequest == NULL ) |
2975 if( aTriggerRequest == NULL ) |
3024 ieLength <= KMaxSSIDLength ) |
3125 ieLength <= KMaxSSIDLength ) |
3025 { |
3126 { |
3026 TWlanAvailableNetwork network; |
3127 TWlanAvailableNetwork network; |
3027 network.ssid.Copy( ieData, ieLength ); |
3128 network.ssid.Copy( ieData, ieLength ); |
3028 network.securityMode = info.SecurityMode(); |
3129 network.securityMode = info.SecurityMode(); |
|
3130 network.rcpi = info.RXLevel(); |
3029 if( info.OperatingMode() == WlanOperatingModeInfra ) |
3131 if( info.OperatingMode() == WlanOperatingModeInfra ) |
3030 { |
3132 { |
3031 network.networkType = Infrastructure; |
3133 network.networkType = Infrastructure; |
3032 } |
3134 } |
3033 else |
3135 else |
3034 { |
3136 { |
3035 network.networkType = Adhoc; |
3137 network.networkType = Adhoc; |
3036 } |
3138 } |
3037 |
3139 |
3038 if ( aNetworkList.Find( network, isEqual ) == KErrNotFound ) |
3140 TInt idx = aNetworkList.Find( network, isEqual ); |
|
3141 if ( idx == KErrNotFound ) |
3039 { |
3142 { |
3040 DEBUG1S( "CWlmServer::GetNetworkList() - appending SSID ", |
3143 DEBUG1S( "CWlmServer::GetNetworkList() - appending SSID ", |
3041 ieLength, ieData ); |
3144 ieLength, ieData ); |
3042 aNetworkList.Append( network ); |
3145 aNetworkList.Append( network ); |
|
3146 } |
|
3147 else if( idx >= 0 && |
|
3148 aNetworkList[idx].rcpi < network.rcpi ) |
|
3149 { |
|
3150 aNetworkList[idx].rcpi = network.rcpi; |
3043 } |
3151 } |
3044 } |
3152 } |
3045 } |
3153 } |
3046 |
3154 |
3047 return KErrNone; |
3155 return KErrNone; |
3459 { |
3568 { |
3460 DEBUG( "CWlmServer::BackgroundScanRequest() - unable to instantiate TUint" ); |
3569 DEBUG( "CWlmServer::BackgroundScanRequest() - unable to instantiate TUint" ); |
3461 |
3570 |
3462 delete iapDataList; |
3571 delete iapDataList; |
3463 delete iapSsidList; |
3572 delete iapSsidList; |
3464 delete iapIdList; |
3573 delete iapAvailabilityList; |
3465 delete scanList; |
3574 delete scanList; |
3466 return KErrNoMemory; |
3575 return KErrNoMemory; |
3467 } |
3576 } |
3468 |
3577 |
3469 // create mapping |
3578 // create mapping |
3470 SRequestMapEntry mapEntry; |
3579 SRequestMapEntry mapEntry; |
3471 mapEntry.iFunction = EGetAvailableIaps; |
3580 mapEntry.iFunction = EGetAvailableIaps; |
3472 mapEntry.iRequestId = KWlanIntCmdBackgroundScan; |
3581 mapEntry.iRequestId = KWlanIntCmdBackgroundScan; |
3473 mapEntry.iSessionId = 0; |
3582 mapEntry.iSessionId = 0; |
3474 mapEntry.iParam0 = iapDataList; |
3583 mapEntry.iParam0 = iapDataList; |
3475 mapEntry.iParam1 = iapIdList; |
3584 mapEntry.iParam1 = iapAvailabilityList; |
3476 mapEntry.iParam2 = scanList; |
3585 mapEntry.iParam2 = scanList; |
3477 mapEntry.iParam3 = iapSsidList; |
3586 mapEntry.iParam3 = iapSsidList; |
|
3587 mapEntry.iParam4 = reinterpret_cast<TAny*>( EFalse ); |
3478 mapEntry.iTime = scanTime; |
3588 mapEntry.iTime = scanTime; |
3479 iRequestMap.Append( mapEntry ); |
3589 iRequestMap.Append( mapEntry ); |
3480 |
3590 |
3481 if( IsOnlyTimedScanRequestInRequestMap( mapEntry ) || *scanTime < iScanSchedulingTimerExpiration ) |
3591 if( IsOnlyTimedScanRequestInRequestMap( mapEntry ) || *scanTime < iScanSchedulingTimerExpiration ) |
3482 { |
3592 { |
3483 // Scan scheduling timer needs to be set again because this request needs the results earlier |
3593 // Scan scheduling timer needs to be set again because this request needs the results earlier |
3484 UpdateScanSchedulingTimer( *scanTime, mapEntry.iRequestId ); |
3594 UpdateScanSchedulingTimer( *scanTime, mapEntry.iRequestId ); |
3485 } |
3595 } |
3545 pckgDynamicScanList().size = 0; |
3655 pckgDynamicScanList().size = 0; |
3546 |
3656 |
3547 if( self->IsSessionActive( self->iRequestMap[index] ) ) |
3657 if( self->IsSessionActive( self->iRequestMap[index] ) ) |
3548 { |
3658 { |
3549 self->iRequestMap[index].iMessage.Write( 2, pckgDynamicScanList ); |
3659 self->iRequestMap[index].iMessage.Write( 2, pckgDynamicScanList ); |
3550 self->iRequestMap[index].iMessage.Complete( KErrNone ); |
3660 |
|
3661 if( self->iPlatform->GetWlanOnOffState() != EWlanOn ) |
|
3662 { |
|
3663 self->iRequestMap[index].iMessage.Complete( self->iPlatform->GetWlanOnOffState() ); |
|
3664 } |
|
3665 else |
|
3666 { |
|
3667 self->iRequestMap[index].iMessage.Complete( KErrServerBusy ); |
|
3668 } |
3551 } |
3669 } |
3552 |
3670 |
3553 delete completedScanList; |
3671 delete completedScanList; |
3554 completedScanList = NULL; |
3672 completedScanList = NULL; |
3555 delete completedSsid; |
3673 delete completedSsid; |
3574 self->iRequestMap[index].iFunction == EGetAvailableIaps ) |
3692 self->iRequestMap[index].iFunction == EGetAvailableIaps ) |
3575 { |
3693 { |
3576 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - GetAvailableIaps" ); |
3694 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - GetAvailableIaps" ); |
3577 |
3695 |
3578 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3696 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3579 core_type_list_c<u32_t>* iapIdList = reinterpret_cast<core_type_list_c<u32_t>*>( self->iRequestMap[index].iParam1 ); |
3697 core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList = |
|
3698 reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( self->iRequestMap[index].iParam1 ); |
3580 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3699 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3581 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3700 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3582 TUint* scanTime = reinterpret_cast<TUint*>( self->iRequestMap[index].iTime ); |
3701 TUint* scanTime = reinterpret_cast<TUint*>( self->iRequestMap[index].iTime ); |
3583 |
3702 |
3584 // If the device is roaming OR |
3703 // If the device is roaming OR |
3598 if( self->IsSessionActive( self->iRequestMap[index] ) ) |
3717 if( self->IsSessionActive( self->iRequestMap[index] ) ) |
3599 { |
3718 { |
3600 TWlmAvailableIaps tmp = { 0 }; |
3719 TWlmAvailableIaps tmp = { 0 }; |
3601 TPckg<TWlmAvailableIaps> outPckg( tmp ); |
3720 TPckg<TWlmAvailableIaps> outPckg( tmp ); |
3602 self->iRequestMap[index].iMessage.Write( 0, outPckg ); |
3721 self->iRequestMap[index].iMessage.Write( 0, outPckg ); |
3603 self->iRequestMap[index].iMessage.Complete( KErrNone ); |
3722 |
|
3723 if( self->iPlatform->GetWlanOnOffState() != EWlanOn ) |
|
3724 { |
|
3725 self->iRequestMap[index].iMessage.Complete( self->iPlatform->GetWlanOnOffState() ); |
|
3726 } |
|
3727 else if( iapDataList->count() == 0 ) |
|
3728 { |
|
3729 self->iRequestMap[index].iMessage.Complete( KErrNone ); |
|
3730 } |
|
3731 else |
|
3732 { |
|
3733 self->iRequestMap[index].iMessage.Complete( KErrServerBusy ); |
|
3734 } |
3604 } |
3735 } |
3605 |
3736 |
3606 delete iapDataList; |
3737 delete iapDataList; |
3607 iapDataList = NULL; |
3738 iapDataList = NULL; |
3608 delete iapIdList; |
3739 delete iapAvailabilityList; |
3609 iapIdList = NULL; |
3740 iapAvailabilityList = NULL; |
3610 delete scanList; |
3741 delete scanList; |
3611 scanList = NULL; |
3742 scanList = NULL; |
3612 delete iapSsidList; |
3743 delete iapSsidList; |
3613 iapSsidList = NULL; |
3744 iapSsidList = NULL; |
3614 delete scanTime; |
3745 delete scanTime; |
3653 { |
3784 { |
3654 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - starting background scan, cancel timer" ); |
3785 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - starting background scan, cancel timer" ); |
3655 // pass request to core |
3786 // pass request to core |
3656 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3787 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3657 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3788 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3658 core_type_list_c<u32_t>* iapIdList = reinterpret_cast<core_type_list_c<u32_t>*>( self->iRequestMap[index].iParam1 ); |
3789 core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList = |
|
3790 reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( self->iRequestMap[index].iParam1 ); |
3659 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3791 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3660 |
3792 |
3661 self->iCoreServer->get_available_iaps( |
3793 self->iCoreServer->get_available_iaps( |
3662 self->iRequestMap[index].iRequestId, |
3794 self->iRequestMap[index].iRequestId, |
3663 isActiveScanAllowed, |
3795 isActiveScanAllowed, |
3664 *iapDataList, |
3796 *iapDataList, |
3665 *iapIdList, |
3797 *iapAvailabilityList, |
3666 iapSsidList, |
3798 iapSsidList, |
3667 *scanList ); |
3799 *scanList ); |
3668 |
3800 |
3669 self->iScanSchedulingTimer->Cancel(); |
3801 self->iScanSchedulingTimer->Cancel(); |
3670 } |
3802 } |
3692 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - starting GetAvailableIaps, cancel timer" ); |
3824 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - starting GetAvailableIaps, cancel timer" ); |
3693 |
3825 |
3694 // pass request to core |
3826 // pass request to core |
3695 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3827 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3696 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3828 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3697 core_type_list_c<u32_t>* iapIdList = reinterpret_cast<core_type_list_c<u32_t>*>( self->iRequestMap[index].iParam1 ); |
3829 core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList = |
|
3830 reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( self->iRequestMap[index].iParam1 ); |
3698 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3831 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3699 |
3832 |
3700 self->iCoreServer->get_available_iaps( |
3833 self->iCoreServer->get_available_iaps( |
3701 self->iRequestMap[index].iRequestId, |
3834 self->iRequestMap[index].iRequestId, |
3702 isActiveScanAllowed, |
3835 isActiveScanAllowed, |
3703 *iapDataList, |
3836 *iapDataList, |
3704 *iapIdList, |
3837 *iapAvailabilityList, |
3705 iapSsidList, |
3838 iapSsidList, |
3706 *scanList ); |
3839 *scanList ); |
3707 |
3840 |
3708 self->iScanSchedulingTimer->Cancel(); |
3841 self->iScanSchedulingTimer->Cancel(); |
3709 } |
3842 } |
4101 iScanSchedulingTimer->Cancel(); |
4234 iScanSchedulingTimer->Cancel(); |
4102 |
4235 |
4103 DEBUG( "CWlmServer::CancelScan() - remove entry from request map" ); |
4236 DEBUG( "CWlmServer::CancelScan() - remove entry from request map" ); |
4104 SRequestMapEntry entry = iRequestMap[index]; |
4237 SRequestMapEntry entry = iRequestMap[index]; |
4105 delete reinterpret_cast<core_type_list_c<core_iap_data_s>*>( entry.iParam0 ); |
4238 delete reinterpret_cast<core_type_list_c<core_iap_data_s>*>( entry.iParam0 ); |
4106 delete reinterpret_cast<core_type_list_c<u32_t>*>( entry.iParam1 ); |
4239 delete reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( entry.iParam1 ); |
4107 delete reinterpret_cast<ScanList*>( entry.iParam2); |
4240 delete reinterpret_cast<ScanList*>( entry.iParam2); |
4108 delete reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( entry.iParam3 ); |
4241 delete reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( entry.iParam3 ); |
4109 delete reinterpret_cast<TUint*>( entry.iTime ); |
4242 delete reinterpret_cast<TUint*>( entry.iTime ); |
4110 iRequestMap.Remove( index ); |
4243 iRequestMap.Remove( index ); |
4111 |
4244 |
4138 DEBUG( "CWlmServer::CancelScan() - just remove the entry from the request map" ); |
4271 DEBUG( "CWlmServer::CancelScan() - just remove the entry from the request map" ); |
4139 |
4272 |
4140 DEBUG( "CWlmServer::CancelScan() - remove entry from request map" ); |
4273 DEBUG( "CWlmServer::CancelScan() - remove entry from request map" ); |
4141 SRequestMapEntry entry = iRequestMap[index]; |
4274 SRequestMapEntry entry = iRequestMap[index]; |
4142 delete reinterpret_cast<core_type_list_c<core_iap_data_s>*>( entry.iParam0 ); |
4275 delete reinterpret_cast<core_type_list_c<core_iap_data_s>*>( entry.iParam0 ); |
4143 delete reinterpret_cast<core_type_list_c<u32_t>*>( entry.iParam1 ); |
4276 delete reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( entry.iParam1 ); |
4144 delete reinterpret_cast<ScanList*>( entry.iParam2); |
4277 delete reinterpret_cast<ScanList*>( entry.iParam2); |
4145 delete reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( entry.iParam3 ); |
4278 delete reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( entry.iParam3 ); |
4146 delete reinterpret_cast<TUint*>( entry.iTime ); |
4279 delete reinterpret_cast<TUint*>( entry.iTime ); |
4147 iRequestMap.Remove( index ); |
4280 iRequestMap.Remove( index ); |
4148 } |
4281 } |
5065 { |
5198 { |
5066 DEBUG( "CWlmServer::HandleSsidListAvailabilityL()" ); |
5199 DEBUG( "CWlmServer::HandleSsidListAvailabilityL()" ); |
5067 |
5200 |
5068 ScanList* scanList = |
5201 ScanList* scanList = |
5069 reinterpret_cast<ScanList*>( aMapEntry.iParam2 ); |
5202 reinterpret_cast<ScanList*>( aMapEntry.iParam2 ); |
5070 core_type_list_c<u32_t>* iapIdList = |
5203 core_type_list_c<core_iap_availability_data_s>* iapAvailabilityList = |
5071 reinterpret_cast<core_type_list_c<u32_t>*>( aMapEntry.iParam1 ); |
5204 reinterpret_cast<core_type_list_c<core_iap_availability_data_s>*>( aMapEntry.iParam1 ); |
5072 |
5205 |
5073 /** |
5206 /** |
5074 * Go through the IAP list and find IAPs that haven't been found |
5207 * Go through the IAP list and find IAPs that haven't been found |
5075 * during GetAvailableIaps and have an SSID list attached. |
5208 * during GetAvailableIaps and have an SSID list attached. |
5076 */ |
5209 */ |
5077 RArray<TWlanLimitedIapData> attachedIapList; |
5210 RArray<TWlanLimitedIapData> attachedIapList; |
5078 CleanupClosePushL( attachedIapList ); |
5211 CleanupClosePushL( attachedIapList ); |
5079 const RArray<TWlanLimitedIapData>& cachedIapList( |
5212 const RArray<TWlanLimitedIapData>& cachedIapList( |
5080 iCache->CachedIapDataList() ); |
5213 iCache->CachedIapDataList() ); |
5081 core_type_list_iterator_c<u32_t> iter( *iapIdList ); |
5214 core_type_list_iterator_c<core_iap_availability_data_s> iter( *iapAvailabilityList ); |
5082 for( TInt idx( 0 ); idx < cachedIapList.Count(); ++idx ) |
5215 for( TInt idx( 0 ); idx < cachedIapList.Count(); ++idx ) |
5083 { |
5216 { |
5084 TBool isFound( EFalse ); |
5217 TBool isFound( EFalse ); |
5085 for( u32_t* item = iter.first(); !isFound && item; item = iter.next() ) |
5218 for( core_iap_availability_data_s* item = iter.first(); !isFound && item; item = iter.next() ) |
5086 { |
5219 { |
5087 if( *item == cachedIapList[idx].iapId ) |
5220 if( item->id == cachedIapList[idx].iapId ) |
5088 { |
5221 { |
5089 isFound = ETrue; |
5222 isFound = ETrue; |
5090 } |
5223 } |
5091 } |
5224 } |
5092 if( !isFound ) |
5225 if( !isFound ) |