78 CVccWlanSignalLevelHandler::CVccWlanSignalLevelHandler( |
81 CVccWlanSignalLevelHandler::CVccWlanSignalLevelHandler( |
79 MVccSignalLevelObserver& aObserver, |
82 MVccSignalLevelObserver& aObserver, |
80 const TSignalLevelParams& aParams, CVccEngPsProperty& aPsProperty ) |
83 const TSignalLevelParams& aParams, CVccEngPsProperty& aPsProperty ) |
81 : CVccSignalLevelHandler( aObserver, aParams ), iVccPsp( aPsProperty ) |
84 : CVccSignalLevelHandler( aObserver, aParams ), iVccPsp( aPsProperty ) |
82 { |
85 { |
|
86 iManualHoDone = EFalse; |
83 } |
87 } |
84 |
88 |
85 // --------------------------------------------------------------------------- |
89 // --------------------------------------------------------------------------- |
86 // Symbian second-phase constructor. |
90 // Symbian second-phase constructor. |
87 // --------------------------------------------------------------------------- |
91 // --------------------------------------------------------------------------- |
246 RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::NotifyChanges" ); |
250 RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::NotifyChanges" ); |
247 RUBY_DEBUG1( " -New strength = -%d dBm", aSignalStrength ); |
251 RUBY_DEBUG1( " -New strength = -%d dBm", aSignalStrength ); |
248 |
252 |
249 iObserver.WlanSignalChanged( aSignalStrength, aClass ); |
253 iObserver.WlanSignalChanged( aSignalStrength, aClass ); |
250 } |
254 } |
|
255 |
|
256 |
|
257 // --------------------------------------------------------------------------- |
|
258 // Handles getting the signal strength and notifying the observer about |
|
259 // strength changes. |
|
260 // --------------------------------------------------------------------------- |
|
261 |
|
262 void CVccWlanSignalLevelHandler::RunL() |
|
263 { |
|
264 RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::RunL" ); |
|
265 |
|
266 // Zero (0) is not acceptable. |
|
267 if ( !iStrength ) |
|
268 { |
|
269 RUBY_DEBUG0( " -0 strength not acceptable, setting to KStrengthMin"); |
|
270 iStrength = KStrengthMin; |
|
271 } |
|
272 |
|
273 RUBY_DEBUG3( " -iStrength = %d iState = %d iOp = %d", iStrength, iState, iOperation ); |
|
274 |
|
275 switch ( iOperation ) |
|
276 { |
|
277 case EOperationGet: |
|
278 { |
|
279 |
|
280 // We are in the Get-mode to get the signal strength. |
|
281 // If the strength is < than the high level (== the strength |
|
282 // is good), start timer to check if we are still in good level |
|
283 // after the timer completes. |
|
284 // The same is done if we have a low level (== bad). |
|
285 |
|
286 RUBY_DEBUG0( " -EOperationGet"); |
|
287 |
|
288 if ( iStrength <= iParams.iHighLevel && iStrength > 0 ) |
|
289 { |
|
290 RUBY_DEBUG0( " set state = EStrengthHigh, op = EOperationWait" ); |
|
291 |
|
292 After( iParams.iHighTimeout ); |
|
293 iState = EStrengthHigh; |
|
294 iOperation = EOperationWait; |
|
295 } |
|
296 else if ( iStrength >= iParams.iLowLevel ) |
|
297 { |
|
298 RUBY_DEBUG0( " set state = EStrengtLow, op = EOperationWait" ); |
|
299 After( iParams.iLowTimeout ); |
|
300 iState = EStrengthLow; |
|
301 iOperation = EOperationWait; |
|
302 } |
|
303 else |
|
304 { |
|
305 RUBY_DEBUG0( " strength between low and high, set op = EOperationNone" ); |
|
306 |
|
307 //WLAN signal is almost weak, check again with low interval |
|
308 After( KWlanPollIntervalLowSignal ); |
|
309 iOperation = EOperationNone; |
|
310 iState = EStrengthLow; |
|
311 // PCLint |
|
312 } |
|
313 break; |
|
314 } |
|
315 |
|
316 case EOperationWait: |
|
317 { |
|
318 |
|
319 // Timer has completed. Check the signal level again. |
|
320 |
|
321 RUBY_DEBUG0( " -EOperationWait" ); |
|
322 RUBY_DEBUG0( " set op = EOperationComplete" ); |
|
323 GetStrength(); |
|
324 |
|
325 SetActive(); |
|
326 |
|
327 iOperation = EOperationComplete; |
|
328 |
|
329 break; |
|
330 } |
|
331 |
|
332 case EOperationComplete: |
|
333 { |
|
334 // Checking signal strength is now done. |
|
335 // Notify our observer (if needed). |
|
336 |
|
337 RUBY_DEBUG1( " -EOperationComplete, iStrength = %d", iStrength ); |
|
338 |
|
339 // Do we have a good signal level? |
|
340 if ( iStrength <= iParams.iHighLevel && iStrength > 0 && iState == EStrengthHigh ) |
|
341 { |
|
342 RUBY_DEBUG0( " -if ( iStrength <= iParams.iHighLevel" ); |
|
343 NotifyChanges( iStrength, MVccSignalLevelObserver::ESignalClassNormal ); |
|
344 } |
|
345 // Or do we have a bad signal level? |
|
346 else if ( iStrength >= iParams.iHighLevel && iState == EStrengthLow ) |
|
347 { |
|
348 RUBY_DEBUG0( " -else if ( iStrength >= iParams.iHighLevel" ); |
|
349 NotifyChanges( iStrength, MVccSignalLevelObserver::ESignalClassWeak ); |
|
350 } |
|
351 else |
|
352 { |
|
353 // PCLint |
|
354 } |
|
355 |
|
356 TTimeIntervalMicroSeconds32 interval; |
|
357 |
|
358 if( iState == EStrengthHigh ) |
|
359 { |
|
360 RUBY_DEBUG0( " high interval" ); |
|
361 interval = KWlanPollIntervalHighSignal; |
|
362 } |
|
363 else |
|
364 { |
|
365 RUBY_DEBUG0( " low interval" ) |
|
366 interval = KWlanPollIntervalLowSignal; |
|
367 } |
|
368 |
|
369 After( interval ); |
|
370 |
|
371 iState = EStrengthUnknown; |
|
372 iOperation = EOperationNone; |
|
373 |
|
374 break; |
|
375 } |
|
376 |
|
377 case EOperationNone: |
|
378 { |
|
379 RUBY_DEBUG0( " -EOperationNone" ); |
|
380 |
|
381 //if manual HO is done then there is no need for checking signal strength so much, |
|
382 //so stopping the loop |
|
383 if( !iManualHoDone ) |
|
384 { |
|
385 RUBY_DEBUG0( " -call GetStrength()" ); |
|
386 GetStrength(); |
|
387 SetActive(); |
|
388 RUBY_DEBUG1( " -iStrength = %d, set op = EOperationGet \ |
|
389 state = EStrengthUnknown", iStrength ); |
|
390 iOperation = EOperationGet; |
|
391 } |
|
392 break; |
|
393 |
|
394 } |
|
395 |
|
396 |
|
397 default: |
|
398 { |
|
399 break; |
|
400 } |
|
401 } |
|
402 |
|
403 } |
|
404 |
|
405 // --------------------------------------------------------------------------- |
|
406 // Lets Wlan Signal Level Handler know is manual handover done or not done |
|
407 // |
|
408 // --------------------------------------------------------------------------- |
|
409 |
|
410 |
|
411 void CVccWlanSignalLevelHandler::SetManualHoDone( TBool aValue ) |
|
412 { |
|
413 RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::SetManualHoDone" ); |
|
414 iManualHoDone = aValue; |
|
415 } |
|
416 |
|
417 |
|
418 // --------------------------------------------------------------------------- |
|
419 // Cancel outstanding requests. |
|
420 // --------------------------------------------------------------------------- |
|
421 // |
|
422 void CVccWlanSignalLevelHandler::DoCancel() |
|
423 { |
|
424 RUBY_DEBUG_BLOCK( "CVccSignalLevelHandler::DoCancel" ); |
|
425 switch ( iOperation ) |
|
426 { |
|
427 case EOperationWait: |
|
428 case EOperationNone: |
|
429 { |
|
430 RUBY_DEBUG0( "EOperationWait / EOperationNone" ); |
|
431 CTimer::DoCancel(); |
|
432 |
|
433 break; |
|
434 } |
|
435 |
|
436 |
|
437 default: |
|
438 { |
|
439 break; |
|
440 } |
|
441 } |
|
442 } |