511 TSensrvChannelInfo channelInfo; |
511 TSensrvChannelInfo channelInfo; |
512 const CLiwMap* chnlInfoMap = ( channelInfoParam->Value() ).AsMap(); |
512 const CLiwMap* chnlInfoMap = ( channelInfoParam->Value() ).AsMap(); |
513 //Retreive Channel Info |
513 //Retreive Channel Info |
514 GetChannelInfoL( channelInfo , chnlInfoMap ); |
514 GetChannelInfoL( channelInfo , chnlInfoMap ); |
515 |
515 |
516 TSensrvProperty measureProperty; |
516 RSensrvPropertyList propertyList; |
517 TSensrvProperty scaleProperty; |
517 CleanupClosePushL( propertyList ); |
518 TRAPD(anErr,iSensorService->GetScaleFactorL( channelInfo , |
518 TRAPD( anErr, iSensorService->GetChannelPropertyL( channelInfo, |
519 measureProperty,scaleProperty )); |
519 propertyList ) ); |
520 |
520 |
521 if( anErr != KErrNone ) |
521 if( anErr != KErrNone ) |
522 { |
522 { |
|
523 CleanupStack::PopAndDestroy( &propertyList ); |
523 iErrorString = KErrInvalidChnlMap.operator()().Alloc(); |
524 iErrorString = KErrInvalidChnlMap.operator()().Alloc(); |
524 User::Leave(KErrArgument); |
525 User::Leave(KErrArgument); |
525 } |
526 } |
526 TReal scaleFactor ; |
527 TReal scaleFactor ; |
527 TReal measureValue; |
528 TInt measureValue; |
528 TInt scaleValue; |
529 TInt scaleValue; |
529 measureProperty.GetValue( measureValue );// 0 or 1 |
530 TInt propCount = propertyList.Count(); |
530 scaleProperty.GetValue( scaleValue); // 8 or 12 |
531 TInt j=0; |
|
532 TInt k=0; |
|
533 // If no properties listed then leave with error - Not found |
|
534 if( propCount == 0 ) |
|
535 { |
|
536 User::Leave( KErrNotFound ); |
|
537 } |
|
538 |
|
539 for (TInt i = 0; i < propCount; i++ ) |
|
540 { |
|
541 if(propertyList[i].GetPropertyId()== KSensrvPropIdMeasureRange) |
|
542 { |
|
543 if(j<1) |
|
544 { |
|
545 propertyList[i].GetValue( measureValue ); |
|
546 j++; |
|
547 } |
|
548 } |
|
549 if(propertyList[i].GetPropertyId()== KSensrvPropIdScaledRange) |
|
550 { |
|
551 if(k<1) |
|
552 { |
|
553 propertyList[i].GetValue( scaleValue ); |
|
554 } |
|
555 } |
|
556 |
|
557 } |
|
558 CleanupStack::PopAndDestroy( &propertyList ); |
531 TReal outputValue; |
559 TReal outputValue; |
532 TInt errPow; |
560 TInt errPow; |
533 errPow = Math::Pow(outputValue,2,scaleValue-1); |
561 errPow = Math::Pow(outputValue,2,scaleValue-1); |
534 if( errPow == KErrNone ) |
562 if( errPow == KErrNone ) |
535 { |
563 { |