summaryrefslogtreecommitdiffstats
path: root/parameter/FixedPointParameterType.cpp
diff options
context:
space:
mode:
authorFrederic Boisnard <fredericx.boisnard@intel.com>2012-03-29 14:06:38 +0200
committerDavid Wagner <david.wagner@intel.com>2014-02-12 17:03:08 +0100
commit258c6f5ae24de2e96ac0a0a842483bdc60b6b063 (patch)
treefe19ca1bd49d608e01296229f705216872ed698c /parameter/FixedPointParameterType.cpp
parentc3fe14faa97348f4452b471f35b1a18088630e01 (diff)
downloadexternal_parameter-framework-258c6f5ae24de2e96ac0a0a842483bdc60b6b063.zip
external_parameter-framework-258c6f5ae24de2e96ac0a0a842483bdc60b6b063.tar.gz
external_parameter-framework-258c6f5ae24de2e96ac0a0a842483bdc60b6b063.tar.bz2
PFW: Fixed bug on fixed point parameter types
BZ: 29464 When reading from the blackboard a value of type fixed point parameter (size < 32 bits), the sign extend was not taken into account: - Added a call to signExtend() before the conversion, - Updated the display as well (precision support), - Set up the notation type (fixed) to prevent the scientific notation display. Compilation on target would fail because of the use of an ambigous function : log10. Changed the notation of the number to double for the parameter of this function to force binding to: double log10(double). Change-Id: Ibb77259b84db33e00971ba662600547522cf9bb1 Signed-off-by: Frederic Boisnard <fredericx.boisnard@intel.com> Reviewed-on: http://android.intel.com:8080/41649 Reviewed-by: De Chivre, RenaudX <renaudx.de.chivre@intel.com> Reviewed-by: Centelles, Sylvain <sylvain.centelles@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: Benavoli, PatrickX <patrickx.benavoli@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter/FixedPointParameterType.cpp')
-rw-r--r--parameter/FixedPointParameterType.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/parameter/FixedPointParameterType.cpp b/parameter/FixedPointParameterType.cpp
index 3f57d77..436ff31 100644
--- a/parameter/FixedPointParameterType.cpp
+++ b/parameter/FixedPointParameterType.cpp
@@ -33,6 +33,7 @@
#include <sstream>
#include <iomanip>
#include <assert.h>
+#include <math.h>
#include "Parameter.h"
#include "ParameterAccessContext.h"
#include "ConfigurationAccessContext.h"
@@ -181,10 +182,14 @@ bool CFixedPointParameterType::fromBlackboard(string& strValue, const uint32_t&
}
} else {
+ // Sign extend
+ signExtend(iData);
+
// Conversion
double dData = asDouble(iData);
- strStream << dData;
+ // Set up the precision of the display and notation type
+ strStream << fixed << setprecision((_uiFractional + 1) * log10(2.0)) << dData;
}
strValue = strStream.str();