incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [23/34] wp7 commit: Added a constant to multiply accelerometer values by, fixes CB-152 for WP7
Date Mon, 09 Apr 2012 22:40:30 GMT
Added a constant to multiply accelerometer values by, fixes CB-152 for WP7


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/commit/d91087fe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/tree/d91087fe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/diff/d91087fe

Branch: refs/heads/master
Commit: d91087fe2179705c27c42f0c0c4e4420379c88c5
Parents: 141e38a
Author: filmaj <maj.fil@gmail.com>
Authored: Sun Apr 8 00:48:52 2012 -0700
Committer: filmaj <maj.fil@gmail.com>
Committed: Sun Apr 8 00:48:52 2012 -0700

----------------------------------------------------------------------
 framework/Cordova/Commands/Accelerometer.cs |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/d91087fe/framework/Cordova/Commands/Accelerometer.cs
----------------------------------------------------------------------
diff --git a/framework/Cordova/Commands/Accelerometer.cs b/framework/Cordova/Commands/Accelerometer.cs
index b941d3c..54cd1fe 100644
--- a/framework/Cordova/Commands/Accelerometer.cs
+++ b/framework/Cordova/Commands/Accelerometer.cs
@@ -68,13 +68,15 @@ namespace WP7CordovaClassLib.Cordova.Commands
 
         #endregion
 
-#region Status codes
+#region Status codes and Constants
 
         public const int Stopped = 0;
         public const int Starting = 1;
         public const int Running = 2;
         public const int ErrorFailedToStart = 3;
 
+        public const double gConstant = -9.81;
+
         #endregion
 
 #region Static members
@@ -294,9 +296,9 @@ namespace WP7CordovaClassLib.Cordova.Commands
         private string GetCurrentAccelerationFormatted()
         {
             string resultCoordinates = String.Format("\"x\":{0},\"y\":{1},\"z\":{2}",
-                            accelerometer.CurrentValue.Acceleration.X.ToString("0.00000",CultureInfo.InvariantCulture),
-                            accelerometer.CurrentValue.Acceleration.Y.ToString("0.00000",
CultureInfo.InvariantCulture),
-                            accelerometer.CurrentValue.Acceleration.Z.ToString("0.00000",
CultureInfo.InvariantCulture));
+                            (accelerometer.CurrentValue.Acceleration.X * gConstant).ToString("0.00000",CultureInfo.InvariantCulture),
+                            (accelerometer.CurrentValue.Acceleration.Y * gConstant).ToString("0.00000",
CultureInfo.InvariantCulture),
+                            (accelerometer.CurrentValue.Acceleration.Z * gConstant).ToString("0.00000",
CultureInfo.InvariantCulture));
             resultCoordinates = "{" + resultCoordinates + "}";
             return resultCoordinates;
         }


Mime
View raw message