86 |
86 |
87 /** Bitmask of WLAN features enabled at compile-time. */ |
87 /** Bitmask of WLAN features enabled at compile-time. */ |
88 const TUint KWlanStaticFeatures = |
88 const TUint KWlanStaticFeatures = |
89 CWlmServer::EWlanFeaturePowerSaveTest | |
89 CWlmServer::EWlanFeaturePowerSaveTest | |
90 CWlmServer::EWlanFeature802dot11k; |
90 CWlmServer::EWlanFeature802dot11k; |
|
91 |
|
92 /** Multiplier for converting seconds into microseconds */ |
|
93 const TUint KWlanSecsToMicrosecsMultiplier( 1000000 ); |
|
94 |
|
95 /** Minimum value for aggressive background scan interval, in seconds */ |
|
96 const TUint KWlanAggressiveBgScanMinInterval( 1 ); |
|
97 |
|
98 /** Maximum value for aggressive background scan interval, in seconds */ |
|
99 const TUint KWlanAggressiveBgScanMaxInterval( 120 ); |
|
100 |
|
101 /** Multiplier for deciding aggressive scan mode duration from set interval */ |
|
102 const TUint KWlanAggressiveBgScanDurationMultiplier( 6 ); |
|
103 |
|
104 /** Interval (in seconds) used for aggressive background scanning after |
|
105 unintentional link break. */ |
|
106 const TUint32 KWlanLinkBreakRecoveryInterval( 10 ); |
|
107 |
|
108 /** How long (in microseconds) aggressive background scanning is performed |
|
109 after unintentional link break. */ |
|
110 const TUint32 KWlanLinkBreakRecoveryDuration( 55000000 ); // 55 seconds |
91 |
111 |
92 // ============================ MEMBER FUNCTIONS =============================== |
112 // ============================ MEMBER FUNCTIONS =============================== |
93 |
113 |
94 // ----------------------------------------------------------------------------- |
114 // ----------------------------------------------------------------------------- |
95 // CWlmServer::CWlmServer |
115 // CWlmServer::CWlmServer |
125 iRequestTriggeringScanning( 0 ), |
145 iRequestTriggeringScanning( 0 ), |
126 iCoreHandlingScanRequest( EFalse ), |
146 iCoreHandlingScanRequest( EFalse ), |
127 iPowerSaveMode( EWlanPowerSaveAutomatic ), |
147 iPowerSaveMode( EWlanPowerSaveAutomatic ), |
128 iPowerSaveEnabled( EFalse ), |
148 iPowerSaveEnabled( EFalse ), |
129 iSsidListDb( NULL ), |
149 iSsidListDb( NULL ), |
130 iShowBrokenPowerSaveNote( ETrue ), |
|
131 iBrokenPowerSaveNotifierWaiter( NULL ), |
|
132 iBgScanProvider( NULL ), |
150 iBgScanProvider( NULL ), |
133 iTimerServices( NULL ) |
151 iTimerServices( NULL ), |
|
152 iAggressiveScanningAfterLinkLoss( EFalse ) |
134 { |
153 { |
135 } |
154 } |
136 |
155 |
137 // ----------------------------------------------------------------------------- |
156 // ----------------------------------------------------------------------------- |
138 // CWlmServer::ConstructL |
157 // CWlmServer::ConstructL |
211 callback, CActive::EPriorityStandard ); |
230 callback, CActive::EPriorityStandard ); |
212 |
231 |
213 // Create SSID list storage. |
232 // Create SSID list storage. |
214 iSsidListDb = CWlanSsidListDb::NewL(); |
233 iSsidListDb = CWlanSsidListDb::NewL(); |
215 |
234 |
216 // Initialise Broken Power Save Note handling |
|
217 TCallBack cb( HandleBrokenPowerSaveNoteClosed, this ); |
|
218 iBrokenPowerSaveNotifierWaiter = CWlanCbWaiter::NewL( cb ); |
|
219 |
|
220 iTimerServices = CWlanTimerServices::NewL(); |
235 iTimerServices = CWlanTimerServices::NewL(); |
221 |
236 |
222 iBgScanProvider = CWlanBgScan::NewL( static_cast<MWlanScanResultProvider&>( *this ), *iTimerServices ); |
237 iBgScanProvider = CWlanBgScan::NewL( static_cast<MWlanScanResultProvider&>( *this ), *iTimerServices ); |
223 |
238 |
224 // Initialize Platform interface and publish mac address |
239 // Initialize Platform interface and publish mac address |
655 void CWlmServer::CancelConnect( |
667 void CWlmServer::CancelConnect( |
656 TUint /* aSessionId */, |
668 TUint /* aSessionId */, |
657 const RMessage2& aMessage ) |
669 const RMessage2& aMessage ) |
658 { |
670 { |
659 DEBUG( "CWlmServer::CancelConnect()" ); |
671 DEBUG( "CWlmServer::CancelConnect()" ); |
|
672 |
|
673 iAggressiveScanningAfterLinkLoss = EFalse; |
660 |
674 |
661 aMessage.Complete( KErrNone ); |
675 aMessage.Complete( KErrNone ); |
662 } |
676 } |
663 |
677 |
664 // --------------------------------------------------------- |
678 // --------------------------------------------------------- |
1240 iapList.Close(); |
1254 iapList.Close(); |
1241 |
1255 |
1242 return; |
1256 return; |
1243 } |
1257 } |
1244 |
1258 |
1245 /** |
|
1246 * If maxDelay is not infinite, background scanning isn't enabled |
|
1247 * and there are no WLAN IAPs defined, scanning isn't needed at all. |
|
1248 */ |
|
1249 if ( maxDelayPckg() != KWlmInfiniteScanDelay && |
|
1250 !iBgScanProvider->IsBgScanEnabled() && |
|
1251 !iapList.Count() ) |
|
1252 { |
|
1253 DEBUG( "CWlmServer::GetAvailableIaps() - no WLAN IAPs defined, skipping scanning" ); |
|
1254 |
|
1255 TWlmAvailableIaps tmp = { 0 }; |
|
1256 TPckg<TWlmAvailableIaps> outPckg( tmp ); |
|
1257 aMessage.Write( 0, outPckg ); |
|
1258 aMessage.Complete( KErrNone ); |
|
1259 iapList.Close(); |
|
1260 |
|
1261 return; |
|
1262 } |
|
1263 |
|
1264 // Create list for WLAN IAP data |
1259 // Create list for WLAN IAP data |
1265 core_type_list_c<core_iap_data_s>* iapDataList = new core_type_list_c<core_iap_data_s>; |
1260 core_type_list_c<core_iap_data_s>* iapDataList = new core_type_list_c<core_iap_data_s>; |
1266 if( iapDataList == NULL ) |
1261 if( iapDataList == NULL ) |
1267 { |
1262 { |
1268 DEBUG( "CWlmServer::GetAvailableIaps() - unable to instance core_iap_data_s list" ); |
1263 DEBUG( "CWlmServer::GetAvailableIaps() - unable to instance core_iap_data_s list" ); |
1791 iIsRoaming = EFalse; |
1784 iIsRoaming = EFalse; |
1792 |
1785 |
1793 // set icon to "not available" |
1786 // set icon to "not available" |
1794 SetIconState( EWlmIconStatusNotAvailable ); |
1787 SetIconState( EWlmIconStatusNotAvailable ); |
1795 |
1788 |
|
1789 // if link was unintentionally lost, scan aggressively |
|
1790 // for a while in order to try to find it again |
|
1791 if( iAggressiveScanningAfterLinkLoss ) |
|
1792 { |
|
1793 TUint32 interval( KWlanLinkBreakRecoveryInterval ); |
|
1794 TUint32 duration( KWlanLinkBreakRecoveryDuration ); |
|
1795 iBgScanProvider->StartAggressiveBgScan( |
|
1796 interval, |
|
1797 duration ); |
|
1798 iAggressiveScanningAfterLinkLoss = EFalse; |
|
1799 } |
|
1800 |
1796 // if background scan is on, this call will cause a background scan |
1801 // if background scan is on, this call will cause a background scan |
1797 // when the background scan is completed, the icon is updated |
1802 // when the background scan is completed, the icon is updated |
1798 iBgScanProvider->NotConnected(); |
1803 iBgScanProvider->NotConnected(); |
1799 |
|
1800 if ( iBrokenPowerSaveNotifierWaiter->IsActive() ) |
|
1801 { |
|
1802 // cancelling the notifier will cause the iBrokenPowerSaveNotifierWaiter |
|
1803 // to be cancelled as well |
|
1804 iBrokenPowerSaveNotifier.CancelNotifier( KUidWlanPowerSaveTestNote ); |
|
1805 } |
|
1806 break; |
1804 break; |
1807 case EWlanStateInfrastructure: |
1805 case EWlanStateInfrastructure: |
1808 DEBUG( "CWlmServer::notify() - STATE: EWlanStateInfrastructure" ); |
1806 DEBUG( "CWlmServer::notify() - STATE: EWlanStateInfrastructure" ); |
1809 iIsRoaming = EFalse; |
1807 iIsRoaming = EFalse; |
1810 SetIconState( EWlmIconStatusConnected ); |
1808 SetIconState( EWlmIconStatusConnected ); |
1863 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficModeChanged<ind>" ); |
1861 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficModeChanged<ind>" ); |
1864 break; |
1862 break; |
1865 case EWlmNotifyAcTrafficStatusChanged: |
1863 case EWlmNotifyAcTrafficStatusChanged: |
1866 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficStatusChanged<ind>" ); |
1864 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficStatusChanged<ind>" ); |
1867 break; |
1865 break; |
1868 case EWlmNotifyBrokenPowerSaveTestFailed: |
|
1869 DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyBrokenPowerSaveTestFailed<ind>" ); |
|
1870 |
|
1871 DEBUG1( "CWlmServer::notify() - iShowBrokenPowerSaveNote: %d", |
|
1872 static_cast<TInt>( iShowBrokenPowerSaveNote ) ); |
|
1873 |
|
1874 if ( iShowBrokenPowerSaveNote ) |
|
1875 { |
|
1876 if ( !iBrokenPowerSaveNotifierWaiter->IsActive() ) |
|
1877 { |
|
1878 TInt err = iBrokenPowerSaveNotifier.Connect(); |
|
1879 DEBUG1( "CWlmServer::notify() - iNotifier.Connect() returned %d", err ); |
|
1880 if ( err == KErrNone ) |
|
1881 { |
|
1882 iBrokenPowerSaveNotifier.StartNotifierAndGetResponse( iBrokenPowerSaveNotifierWaiter->RequestStatus(), |
|
1883 KUidWlanPowerSaveTestNote, KNullDesC8(), iBrokenPowerSaveNotifierReply ); |
|
1884 |
|
1885 iBrokenPowerSaveNotifierWaiter->IssueRequest(); |
|
1886 } |
|
1887 } |
|
1888 #ifdef _DEBUG |
|
1889 else |
|
1890 { |
|
1891 DEBUG( "CWlmServer::notify() - Notifier already active on the screen" ); |
|
1892 } |
|
1893 #endif |
|
1894 } |
|
1895 break; |
|
1896 default: |
1866 default: |
1897 break; |
1867 break; |
1898 } |
1868 } |
1899 } |
|
1900 |
|
1901 // --------------------------------------------------------- |
|
1902 // CWlmServer::BrokenPowerSaveNoteClosed |
|
1903 // --------------------------------------------------------- |
|
1904 // |
|
1905 TInt CWlmServer::HandleBrokenPowerSaveNoteClosed( |
|
1906 TAny *aThisPtr ) |
|
1907 { |
|
1908 DEBUG( "CWlmServer::HandleBrokenPowerSaveNoteClosed()" ); |
|
1909 |
|
1910 CWlmServer* self = static_cast<CWlmServer*>( aThisPtr ); |
|
1911 |
|
1912 ASSERT( self ); |
|
1913 ASSERT( self->iBrokenPowerSaveNotifierWaiter ); |
|
1914 |
|
1915 // close the notifier |
|
1916 self->iBrokenPowerSaveNotifier.Close(); |
|
1917 |
|
1918 // check the request's completion status |
|
1919 TInt err = self->iBrokenPowerSaveNotifierWaiter->RequestStatus().Int(); |
|
1920 switch ( err ) |
|
1921 { |
|
1922 case KErrNotFound: |
|
1923 { |
|
1924 DEBUG( "CWlmServer::HandleBrokenPowerSaveNoteClosed() - Notifier not found, returning" ); |
|
1925 return err; |
|
1926 } |
|
1927 case KErrCancel: |
|
1928 { |
|
1929 DEBUG( "CWlmServer::HandleBrokenPowerSaveNoteClosed() - Notifier cancelled, returning" ); |
|
1930 return err; |
|
1931 } |
|
1932 default: |
|
1933 { |
|
1934 // flow through |
|
1935 } |
|
1936 } |
|
1937 |
|
1938 self->iShowBrokenPowerSaveNote = self->iBrokenPowerSaveNotifierReply() ? EFalse : ETrue; |
|
1939 |
|
1940 // re-use err variable |
|
1941 TRAP( err, self->StoreWlanCenRepKeyValueL( KWlanShowBrokenPowerSaveNote, self->iShowBrokenPowerSaveNote ) ); |
|
1942 if ( err != KErrNone ) |
|
1943 { |
|
1944 DEBUG1( "CWlmServer::HandleBrokenPowerSaveNoteClosed() - failed to update CenRep, error code %d", err ); |
|
1945 return err; |
|
1946 } |
|
1947 |
|
1948 DEBUG1( "CWlmServer::HandleBrokenPowerSaveNoteClosed() - iShowBrokenPowerSaveNote value (%d) stored to CenRep", |
|
1949 static_cast<TInt>( self->iShowBrokenPowerSaveNote ) ); |
|
1950 |
|
1951 return err; |
|
1952 } |
1869 } |
1953 |
1870 |
1954 // --------------------------------------------------------- |
1871 // --------------------------------------------------------- |
1955 // CWlmServer::NotifyChangedPsmSrvMode |
1872 // CWlmServer::NotifyChangedPsmSrvMode |
1956 // --------------------------------------------------------- |
1873 // --------------------------------------------------------- |
2068 if ( iRegion == EETSI ) |
1984 if ( iRegion == EETSI ) |
2069 { |
1985 { |
2070 region = KWlmRegionETSI; |
1986 region = KWlmRegionETSI; |
2071 } |
1987 } |
2072 |
1988 |
2073 TRAPD( ret, StoreWlanCenRepKeyValueL( KWlanRegion, region )); |
1989 StoreRegionAndTimestamp( region, ( iTimeofDomainQuery.Int64() / KWlmTimestampInCenrep ) ); |
2074 if ( ret == KErrNone ) |
1990 |
2075 { |
|
2076 TRAP( ret, StoreWlanCenRepKeyValueL( KWlanRegionTimestamp, ( iTimeofDomainQuery.Int64() / KWlmTimestampInCenrep ) )); |
|
2077 if ( ret == KErrNone ) |
|
2078 { |
|
2079 DEBUG1( "CWlmServer::regulatory_domain() - stored regulatory domain is 0x%02X ", iRegion ); |
|
2080 } |
|
2081 else |
|
2082 { |
|
2083 DEBUG1( "CWlmServer::regulatory_domain() - attempt to store region timestamp leaved with code %d,", ret ); |
|
2084 } |
|
2085 } |
|
2086 else |
|
2087 { |
|
2088 DEBUG1( "CWlmServer::regulatory_domain() - attempt to store region leaved with code %d,", ret ); |
|
2089 } |
|
2090 } |
1991 } |
2091 // If the APs country information was inconsistent then region is selected to be ETSI |
1992 // If the APs country information was inconsistent then region is selected to be ETSI |
2092 else |
1993 else |
2093 { |
1994 { |
2094 iRegion = EETSI; |
1995 iRegion = EETSI; |
2095 iTimeofDomainQuery.UniversalTime(); |
1996 iTimeofDomainQuery.UniversalTime(); |
2096 |
1997 |
2097 DEBUG1( "CWlmServer::store_ap_country_info() - regulatory domain is 0x%02X", iRegion ); |
1998 DEBUG1( "CWlmServer::store_ap_country_info() - regulatory domain is 0x%02X", iRegion ); |
2098 } |
1999 } |
2099 |
2000 |
2100 |
|
2101 // Set timers to notice if system time is changed |
2001 // Set timers to notice if system time is changed |
2102 iPlatform->InitializeSystemTimeHandler(); |
2002 iPlatform->InitializeSystemTimeHandler(); |
2103 |
2003 |
2104 iCoreAsynchCbId = request_id; |
2004 iCoreAsynchCbId = request_id; |
2105 iCoreAsynchCbStatus = core_error_ok; |
2005 iCoreAsynchCbStatus = core_error_ok; |
2106 iCoreAsynchCb->CallBack(); |
2006 iCoreAsynchCb->CallBack(); |
2107 |
2007 |
|
2008 } |
|
2009 |
|
2010 // --------------------------------------------------------- |
|
2011 // CWlmServer::StoreRegionAndTimestamp |
|
2012 // --------------------------------------------------------- |
|
2013 // |
|
2014 void CWlmServer::StoreRegionAndTimestamp( const TInt aRegion, const TInt aTimestamp ) |
|
2015 { |
|
2016 TRAPD( ret, StoreWlanCenRepKeyValueL( KWlanRegion, aRegion ) ); |
|
2017 if ( ret == KErrNone ) |
|
2018 { |
|
2019 TRAP( ret, StoreWlanCenRepKeyValueL( KWlanRegionTimestamp, aTimestamp ) ); |
|
2020 if ( ret == KErrNone ) |
|
2021 { |
|
2022 DEBUG1( "CWlmServer::StoreRegionAndTimestamp() - stored regulatory domain is 0x%02X ", aRegion ); |
|
2023 } |
|
2024 else |
|
2025 { |
|
2026 DEBUG1( "CWlmServer::StoreRegionAndTimestamp() - attempt to store region timestamp leaved with code %d,", ret ); |
|
2027 } |
|
2028 } |
|
2029 else |
|
2030 { |
|
2031 DEBUG1( "CWlmServer::StoreRegionAndTimestamp() - attempt to store region leaved with code %d,", ret ); |
|
2032 } |
2108 } |
2033 } |
2109 |
2034 |
2110 // --------------------------------------------------------- |
2035 // --------------------------------------------------------- |
2111 // CWlmServer::get_regulatory_domain |
2036 // CWlmServer::get_regulatory_domain |
2112 // --------------------------------------------------------- |
2037 // --------------------------------------------------------- |
2155 DEBUG( "CWlmServer::regulatory_domain() - MCC matches a US MCC" ); |
2080 DEBUG( "CWlmServer::regulatory_domain() - MCC matches a US MCC" ); |
2156 iRegion = EFCC; |
2081 iRegion = EFCC; |
2157 break; |
2082 break; |
2158 } |
2083 } |
2159 } |
2084 } |
2160 // Write the WLAN region and timestamp to CenRep |
2085 |
2161 TInt wlanRegion( KWlmRegionFCC ); |
2086 TInt wlanRegion( KWlmRegionFCC ); |
2162 if ( iRegion == EETSI ) |
2087 if ( iRegion == EETSI ) |
2163 { |
2088 { |
2164 wlanRegion = KWlmRegionETSI; |
2089 wlanRegion = KWlmRegionETSI; |
2165 } |
2090 } |
2166 |
2091 |
2167 TRAPD( ret, StoreWlanCenRepKeyValueL( KWlanRegion, wlanRegion )); |
2092 // Store the WLAN region and timestamp to CenRep |
2168 if ( ret == KErrNone ) |
2093 StoreRegionAndTimestamp( wlanRegion, ( iTimeofDomainQuery.Int64() / KWlmTimestampInCenrep ) ); |
2169 { |
|
2170 TRAP( ret, StoreWlanCenRepKeyValueL( KWlanRegionTimestamp, ( iTimeofDomainQuery.Int64() / KWlmTimestampInCenrep ) )); |
|
2171 if ( ret == KErrNone ) |
|
2172 { |
|
2173 DEBUG1( "CWlmServer::regulatory_domain() - stored regulatory domain is 0x%02X ", iRegion ); |
|
2174 } |
|
2175 else |
|
2176 { |
|
2177 DEBUG1( "CWlmServer::regulatory_domain() - attempt to store timestamp leaved with code %d,", ret ); |
|
2178 } |
|
2179 } |
|
2180 else |
|
2181 { |
|
2182 DEBUG1( "CWlmServer::regulatory_domain() - attempt to store region leaved with code %d,", ret ); |
|
2183 } |
|
2184 |
2094 |
2185 // Set timers to notice if system time is changed |
2095 // Set timers to notice if system time is changed |
2186 iPlatform->InitializeSystemTimeHandler(); |
2096 iPlatform->InitializeSystemTimeHandler(); |
2187 |
2097 |
2188 } |
2098 } |
2230 if ( iRegion == EETSI ) |
2140 if ( iRegion == EETSI ) |
2231 { |
2141 { |
2232 wlanRegion = KWlmRegionETSI; |
2142 wlanRegion = KWlmRegionETSI; |
2233 } |
2143 } |
2234 |
2144 |
2235 TRAPD( ret, StoreWlanCenRepKeyValueL( KWlanRegion, wlanRegion )); |
2145 StoreRegionAndTimestamp( wlanRegion, ( iTimeofDomainQuery.Int64() / KWlmTimestampInCenrep ) ); |
2236 if ( ret == KErrNone ) |
|
2237 { |
|
2238 TRAP( ret, StoreWlanCenRepKeyValueL( KWlanRegionTimestamp, ( iTimeofDomainQuery.Int64() / KWlmTimestampInCenrep ) )); |
|
2239 if ( ret == KErrNone ) |
|
2240 { |
|
2241 DEBUG1( "CWlmServer::regulatory_domain() - stored regulatory domain is 0x%02X ", iRegion ); |
|
2242 } |
|
2243 else |
|
2244 { |
|
2245 DEBUG1( "CWlmServer::regulatory_domain() - attempt to store region timestamp leaved with code %d,", ret ); |
|
2246 } |
|
2247 } |
|
2248 else |
|
2249 { |
|
2250 DEBUG1( "CWlmServer::regulatory_domain() - attempt to store region leaved with code %d,", ret ); |
|
2251 } |
|
2252 |
2146 |
2253 // Set timers to notice if system time is changed |
2147 // Set timers to notice if system time is changed |
2254 iPlatform->InitializeSystemTimeHandler(); |
2148 iPlatform->InitializeSystemTimeHandler(); |
2255 |
2149 |
2256 } |
2150 } |
2407 coreIapData->security_mode ) ); |
2301 coreIapData->security_mode ) ); |
2408 iRequestMap[triggerIndex].iMessage.Complete( |
2302 iRequestMap[triggerIndex].iMessage.Complete( |
2409 TWlanConversionUtil::ConvertConnectStatus( |
2303 TWlanConversionUtil::ConvertConnectStatus( |
2410 *connectionStatus, |
2304 *connectionStatus, |
2411 coreIapData->security_mode ) ); |
2305 coreIapData->security_mode ) ); |
|
2306 if( *connectionStatus == core_connect_ok ) |
|
2307 { |
|
2308 // If connection succeeded, raise flag indicating that |
|
2309 // aggressive background scanning has to be carried out |
|
2310 // in case the connection drops |
|
2311 iAggressiveScanningAfterLinkLoss = ETrue; |
|
2312 } |
2412 } |
2313 } |
2413 else if ( IsSessionActive( iRequestMap[triggerIndex] ) ) |
2314 else if ( IsSessionActive( iRequestMap[triggerIndex] ) ) |
2414 { |
2315 { |
2415 DEBUG2("CONNECT COMPLETED WITH error == %u -> adapt == %d", |
2316 DEBUG2("CONNECT COMPLETED WITH error == %u -> adapt == %d", |
2416 status, |
2317 status, |
3602 |
3503 |
3603 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - message completed with empty scan results" ); |
3504 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - message completed with empty scan results" ); |
3604 return KErrNone; |
3505 return KErrNone; |
3605 } |
3506 } |
3606 |
3507 |
3607 // If roaming is ongoing, scanning is not started for GetAvailableIaps. |
3508 // If the command is GetAvailableIaps |
3608 if ( self->iRequestMap[index].iRequestId >= KWlanExtCmdBase && |
3509 if ( self->iRequestMap[index].iRequestId >= KWlanExtCmdBase && |
3609 self->iRequestMap[index].iFunction == EGetAvailableIaps && |
3510 self->iRequestMap[index].iFunction == EGetAvailableIaps ) |
3610 self->IsRoaming() ) |
3511 { |
3611 { |
3512 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - GetAvailableIaps requested" ); |
3612 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - GetAvailableIaps, roam in progress, returning empty iap list" ); |
|
3613 |
3513 |
3614 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3514 core_type_list_c<core_iap_data_s>* iapDataList = reinterpret_cast<core_type_list_c<core_iap_data_s>*>( self->iRequestMap[index].iParam0 ); |
3615 core_type_list_c<u32_t>* iapIdList = reinterpret_cast<core_type_list_c<u32_t>*>( self->iRequestMap[index].iParam1 ); |
3515 core_type_list_c<u32_t>* iapIdList = reinterpret_cast<core_type_list_c<u32_t>*>( self->iRequestMap[index].iParam1 ); |
3616 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3516 ScanList* scanList = reinterpret_cast<ScanList*>( self->iRequestMap[index].iParam2 ); |
3617 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3517 core_type_list_c<core_ssid_entry_s>* iapSsidList = reinterpret_cast<core_type_list_c<core_ssid_entry_s>*>( self->iRequestMap[index].iParam3 ); |
3618 TTime* scanTime = reinterpret_cast<TTime*>( self->iRequestMap[index].iTime ); |
3518 TTime* scanTime = reinterpret_cast<TTime*>( self->iRequestMap[index].iTime ); |
3619 |
3519 |
3620 // Only the triggering request is completed and then scan scheduling timer is set again |
3520 // If the device is roaming OR there are not WLAN IAPs defined in the device |
3621 if( self->IsSessionActive( self->iRequestMap[index] ) ) |
3521 // --> return empty list |
3622 { |
3522 if( self->IsRoaming() || iapDataList->count() == 0 ) |
3623 TWlmAvailableIaps tmp = { 0 }; |
3523 { |
3624 TPckg<TWlmAvailableIaps> outPckg( tmp ); |
3524 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - Device is roaming or no IAPs defined, returning empty list" ); |
3625 self->iRequestMap[index].iMessage.Write( 0, outPckg ); |
3525 // Only the triggering request is completed and then scan scheduling timer is set again |
3626 self->iRequestMap[index].iMessage.Complete( KErrNone ); |
3526 if( self->IsSessionActive( self->iRequestMap[index] ) ) |
3627 } |
3527 { |
3628 |
3528 TWlmAvailableIaps tmp = { 0 }; |
3629 delete iapDataList; |
3529 TPckg<TWlmAvailableIaps> outPckg( tmp ); |
3630 iapDataList = NULL; |
3530 self->iRequestMap[index].iMessage.Write( 0, outPckg ); |
3631 delete iapIdList; |
3531 self->iRequestMap[index].iMessage.Complete( KErrNone ); |
3632 iapIdList = NULL; |
3532 } |
3633 delete scanList; |
3533 |
3634 scanList = NULL; |
3534 delete iapDataList; |
3635 delete iapSsidList; |
3535 iapDataList = NULL; |
3636 iapSsidList = NULL; |
3536 delete iapIdList; |
3637 delete scanTime; |
3537 iapIdList = NULL; |
3638 scanTime = NULL; |
3538 delete scanList; |
|
3539 scanList = NULL; |
|
3540 delete iapSsidList; |
|
3541 iapSsidList = NULL; |
|
3542 delete scanTime; |
|
3543 scanTime = NULL; |
3639 |
3544 |
3640 self->iRequestMap.Remove( index ); |
3545 self->iRequestMap.Remove( index ); |
3641 |
3546 |
3642 if( self->FindNextTimedScanSchedulingRequest( indexNextScan ) ) |
3547 if( self->FindNextTimedScanSchedulingRequest( indexNextScan ) ) |
3643 { |
3548 { |
3644 TTime* nextScanTime = reinterpret_cast<TTime*>( self->iRequestMap[indexNextScan].iTime ); |
3549 TTime* nextScanTime = reinterpret_cast<TTime*>( self->iRequestMap[indexNextScan].iTime ); |
3645 self->UpdateScanSchedulingTimer( *nextScanTime, self->iRequestMap[indexNextScan].iRequestId ); |
3550 self->UpdateScanSchedulingTimer( *nextScanTime, self->iRequestMap[indexNextScan].iRequestId ); |
3646 } |
3551 } |
3647 |
3552 |
3648 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - message completed with empty iap list" ); |
3553 DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - message completed with empty iap list" ); |
3649 return KErrNone; |
3554 return KErrNone; |
|
3555 } |
3650 } |
3556 } |
3651 |
3557 |
3652 // If triggering request is background scan and WLAN connection exist, background scan is skipped |
3558 // If triggering request is background scan and WLAN connection exist, background scan is skipped |
3653 if( self->iRequestMap[index].iRequestId == KWlanIntCmdBackgroundScan && |
3559 if( self->iRequestMap[index].iRequestId == KWlanIntCmdBackgroundScan && |
3654 self->iConnectionState != EWlanStateNotConnected ) |
3560 self->iConnectionState != EWlanStateNotConnected ) |
3938 { |
3844 { |
3939 // Region cache expires when user has changed the time |
3845 // Region cache expires when user has changed the time |
3940 TTime timestampClear(1); |
3846 TTime timestampClear(1); |
3941 iTimeofDomainQuery = timestampClear; |
3847 iTimeofDomainQuery = timestampClear; |
3942 |
3848 |
3943 TRAPD( ret, StoreWlanCenRepKeyValueL( KWlanRegion, KWlmRegionUnknown )); |
3849 StoreRegionAndTimestamp( KWlmRegionUnknown, ( iTimeofDomainQuery.Int64() / KWlmTimestampInCenrep ) ); |
3944 if ( ret == KErrNone ) |
|
3945 { |
|
3946 TRAP( ret, StoreWlanCenRepKeyValueL( KWlanRegionTimestamp, iTimeofDomainQuery.Int64() )); |
|
3947 if ( ret != KErrNone ) |
|
3948 { |
|
3949 DEBUG1( "CWlmServer::SystemTimeChanged() - attempt to store region timestamp leaved with code %d,", ret ); |
|
3950 } |
|
3951 } |
|
3952 else |
|
3953 { |
|
3954 DEBUG1( "CWlmServer::SystemTimeChanged() - attempt to store region leaved with code %d,", ret ); |
|
3955 } |
|
3956 } |
3850 } |
3957 |
3851 |
3958 DEBUG("CWlmServer::SystemTimeChanged() - inform timer services about system time change"); |
3852 DEBUG("CWlmServer::SystemTimeChanged() - inform timer services about system time change"); |
3959 iTimerServices->HandleTimeout(); |
3853 iTimerServices->HandleTimeout(); |
3960 DEBUG("CWlmServer::SystemTimeChanged() - refreshing settings to BgScan provider"); |
3854 DEBUG("CWlmServer::SystemTimeChanged() - refreshing settings to BgScan provider"); |
4004 |
3898 |
4005 // Region cache expires when user has changed the time |
3899 // Region cache expires when user has changed the time |
4006 TTime timestampClear(1); |
3900 TTime timestampClear(1); |
4007 iTimeofDomainQuery = timestampClear; |
3901 iTimeofDomainQuery = timestampClear; |
4008 |
3902 |
4009 TRAPD( ret, StoreWlanCenRepKeyValueL( KWlanRegion, KWlmRegionUnknown )); |
3903 StoreRegionAndTimestamp( KWlmRegionUnknown, ( iTimeofDomainQuery.Int64() / KWlmTimestampInCenrep ) ); |
4010 if ( ret != KErrNone ) |
3904 |
4011 { |
|
4012 DEBUG1( "CWlmServer::ClearRegionCache() - StoreWlanCenRepKeyValueL() leaved with code %d,", ret ); |
|
4013 } |
|
4014 TRAP( ret, StoreWlanCenRepKeyValueL( KWlanRegionTimestamp, iTimeofDomainQuery.Int64() )); |
|
4015 if ( ret != KErrNone ) |
|
4016 { |
|
4017 DEBUG1( "CWlmServer::ClearRegionCache() - StoreWlanCenRepKeyValueL() leaved with code %d,", ret ); |
|
4018 } |
|
4019 } |
3905 } |
4020 |
3906 |
4021 // --------------------------------------------------------- |
3907 // --------------------------------------------------------- |
4022 // CWlmServer::SendData |
3908 // CWlmServer::SendData |
4023 // --------------------------------------------------------- |
3909 // --------------------------------------------------------- |
4174 } |
4062 } |
4175 DEBUG( "CWlmServer::CancelScan() - returning" ); |
4063 DEBUG( "CWlmServer::CancelScan() - returning" ); |
4176 } |
4064 } |
4177 |
4065 |
4178 // --------------------------------------------------------- |
4066 // --------------------------------------------------------- |
|
4067 // CWlmServer::StartAggressiveBgScan |
|
4068 // --------------------------------------------------------- |
|
4069 // |
|
4070 void CWlmServer::StartAggressiveBgScan( |
|
4071 TUint /* aSessionId */, |
|
4072 const RMessage2& aMessage ) |
|
4073 { |
|
4074 DEBUG( "CWlmServer::StartAggressiveBgScan" ); |
|
4075 |
|
4076 // Scan interval in seconds |
|
4077 TUint32 ScanInterval( aMessage.Int0() ); |
|
4078 |
|
4079 aMessage.Complete( KErrNone ); |
|
4080 |
|
4081 // Check that requested interval is in valid range |
|
4082 // and if it is not, adjust the value. |
|
4083 if( ScanInterval < KWlanAggressiveBgScanMinInterval ) |
|
4084 { |
|
4085 DEBUG1( "CWlmServer::StartAggressiveBgScan - Requested value (%u) is below minimum limit", |
|
4086 ScanInterval ); |
|
4087 ScanInterval = KWlanAggressiveBgScanMinInterval; |
|
4088 } |
|
4089 else if( ScanInterval > KWlanAggressiveBgScanMaxInterval ) |
|
4090 { |
|
4091 DEBUG1( "CWlmServer::StartAggressiveBgScan - Requested value (%u) is above maximum limit", |
|
4092 ScanInterval ); |
|
4093 ScanInterval = KWlanAggressiveBgScanMaxInterval; |
|
4094 } |
|
4095 |
|
4096 // Calculate from scan interval how long the aggressive |
|
4097 // mode will be kept active |
|
4098 TUint32 duration( KWlanAggressiveBgScanDurationMultiplier * |
|
4099 ScanInterval * |
|
4100 KWlanSecsToMicrosecsMultiplier ); |
|
4101 |
|
4102 // Forward request to BG scan module |
|
4103 iBgScanProvider->StartAggressiveBgScan( |
|
4104 ScanInterval, |
|
4105 duration ); |
|
4106 } |
|
4107 |
|
4108 // --------------------------------------------------------- |
4179 // CWlmServer::GetPacketStatistics |
4109 // CWlmServer::GetPacketStatistics |
4180 // --------------------------------------------------------- |
4110 // --------------------------------------------------------- |
4181 // |
4111 // |
4182 void CWlmServer::GetPacketStatistics( |
4112 void CWlmServer::GetPacketStatistics( |
4183 TUint aSessionId, |
4113 TUint aSessionId, |