equal
deleted
inserted
replaced
237 else |
237 else |
238 { |
238 { |
239 TReal ed = 0.0; |
239 TReal ed = 0.0; |
240 if( KErrNotFound != ComputeED( ed, cellInfo, iPrevCellInfo ) ) |
240 if( KErrNotFound != ComputeED( ed, cellInfo, iPrevCellInfo ) ) |
241 { |
241 { |
242 iED.Append( ed ); |
242 TInt error = iED.Append( ed ); |
|
243 if( error != KErrNone ) |
|
244 { |
|
245 LOG1("Failed to append ed to the array:%d",error); |
|
246 } |
243 iSumOfED += ed; |
247 iSumOfED += ed; |
244 if( iED.Count() == 5 ) |
248 if( iED.Count() == 5 ) |
245 { |
249 { |
246 ComputeVarianceOfED(); |
250 ComputeVarianceOfED(); |
247 if( iAvgOfVariance > 5.0 ) |
251 if( iAvgOfVariance > 5.0 ) |
371 { |
375 { |
372 LOG("Reason:1"); |
376 LOG("Reason:1"); |
373 return ETrue; |
377 return ETrue; |
374 } |
378 } |
375 |
379 |
376 iSumOfSd.Append( sumOfSd ); |
380 TInt error = iSumOfSd.Append( sumOfSd ); |
377 iVarianceOfRssi.Append( aCarrierRSSISD ); |
381 if( error != KErrNone ) |
|
382 { |
|
383 LOG1("Append sumOfSd to the array:%d",error); |
|
384 } |
|
385 error = iVarianceOfRssi.Append( aCarrierRSSISD ); |
|
386 if( error != KErrNone ) |
|
387 { |
|
388 LOG1("Append aCarrierRSSISD to the array:%d",error); |
|
389 } |
378 if( iSumOfSd.Count() == 3 ) |
390 if( iSumOfSd.Count() == 3 ) |
379 { |
391 { |
380 TReal sumAvg = 0.0; |
392 TReal sumAvg = 0.0; |
381 TReal rssiAvg = 0.0; |
393 TReal rssiAvg = 0.0; |
382 for( TInt i=0;i<iSumOfSd.Count();i++ ) |
394 for( TInt i=0;i<iSumOfSd.Count();i++ ) |
487 { |
499 { |
488 // Calculate difference in RxLEV and the corresponding square |
500 // Calculate difference in RxLEV and the corresponding square |
489 TInt diff = |
501 TInt diff = |
490 ( ( aPrevCellInfo->GetNMR() )[pos].RxLEV ) - ( nmr.RxLEV ); |
502 ( ( aPrevCellInfo->GetNMR() )[pos].RxLEV ) - ( nmr.RxLEV ); |
491 Math::Pow( diffSqr, diff, 2 ); |
503 Math::Pow( diffSqr, diff, 2 ); |
492 diffArray.Append( diffSqr ); |
504 TInt error = diffArray.Append( diffSqr ); |
493 posArray.Append( pos ); |
505 if( error != KErrNone ) |
|
506 { |
|
507 LOG1("Failed to append to diff array:%d",error); |
|
508 } |
|
509 error = posArray.Append( pos ); |
|
510 if( error !=KErrNone ) |
|
511 { |
|
512 LOG1("Failed to append to pos array:%d",error); |
|
513 } |
494 } |
514 } |
495 else |
515 else |
496 { |
516 { |
497 TInt diff = nmr.RxLEV - leastRxLEV; |
517 TInt diff = nmr.RxLEV - leastRxLEV; |
498 Math::Pow( diffSqr, diff, 2 ); |
518 Math::Pow( diffSqr, diff, 2 ); |
554 sum += sqr; |
574 sum += sqr; |
555 } |
575 } |
556 |
576 |
557 iED.Reset(); |
577 iED.Reset(); |
558 TReal variance = sum / 5; |
578 TReal variance = sum / 5; |
559 iVarianceOfED.Append( variance ); |
579 TInt error = iVarianceOfED.Append( variance ); |
|
580 if( error != KErrNone ) |
|
581 { |
|
582 LOG1("Failed to append variance:%d",error); |
|
583 } |
|
584 |
560 |
585 |
561 // Check if variance is > 5. If true then check the next set of |
586 // Check if variance is > 5. If true then check the next set of |
562 // 5 variances. If there are more than two variance readings > 5 |
587 // 5 variances. If there are more than two variance readings > 5 |
563 // then compute average of the 5 readings and check if this value |
588 // then compute average of the 5 readings and check if this value |
564 // is > 5. If true then notify movement. |
589 // is > 5. If true then notify movement. |