You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/10/22 02:12:13 UTC

[1/6] git commit: fxos added, not working

Updated Branches:
  refs/heads/dev 3576342c5 -> 9db09502e


fxos added, not working


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/6d3a17bc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/6d3a17bc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/6d3a17bc

Branch: refs/heads/dev
Commit: 6d3a17bca3e02c8130fdd2a8c83c57cf1da4c12f
Parents: 81b8f96
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Fri Sep 20 11:09:30 2013 +0200
Committer: Piotr Zalewa <pi...@zalewa.info>
Committed: Fri Sep 20 11:09:30 2013 +0200

----------------------------------------------------------------------
 plugin.xml                     | 13 +++++++++++
 src/firefoxos/accelerometer.js | 44 +++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/6d3a17bc/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 032ab01..cd7e840 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -17,6 +17,19 @@
         <clobbers target="navigator.accelerometer" />
     </js-module>
     
+    <!-- firefoxos -->
+    <platform name="firefoxos">
+        <config-file target="config.xml" parent="/*">
+            <feature name="Accelerometer">
+                <param name="firefoxos-package" value="Accelerometer" />
+            </feature>
+        </config-file>                                         
+        
+        <js-module src="src/firefoxos/accelerometer.js" name="accelerometer-impl">
+          <runs />
+        </js-module>
+    </platform>
+
     <!-- android -->
     <platform name="android">
 	    

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/6d3a17bc/src/firefoxos/accelerometer.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/accelerometer.js b/src/firefoxos/accelerometer.js
new file mode 100644
index 0000000..bde8acc
--- /dev/null
+++ b/src/firefoxos/accelerometer.js
@@ -0,0 +1,44 @@
+var firefoxos = require('cordova/platform');
+
+// initiate watching the acceleration and clear it straight afterwards
+function getCurrentAcceleration(accelerometerSuccess, accelerometerError) {
+    var listener = document.addEventListener('devicemotion', accelerationCallback, false);
+    function accelerationCallback(deviceMotionEvent) {
+        accelerometerSuccess(deviceMotionEvent.acceleration);
+        document.removeEventListener('devicemotion', listener, false);
+    }
+}
+
+// listen to acceleration and call accelerometerSuccess every x milliseconds
+function watchAcceleration(accelerometerSuccess, accelerometerError, options) {
+    // last timestamp when callback was called
+    var hit = 0;
+    var frequency = 0;
+    if (options && options.frequency) {
+        frequency = options.frequency;
+    }
+    function accelerationCallback(deviceMotionEvent) {
+        var newHit;
+        if (frequency) {
+          newHit = new Date().getTime();
+        }
+        if (!frequency || newHit >= hit + frequency) {
+            // return acceleration object instead of event
+            accelerometerSuccess(deviceMotionEvent.acceleration);
+            hit = newHit;
+        }
+    }
+    return document.removeEventListener('devicemotion', accelerationCallback, false);
+}
+
+function clearWatch(watchId) {
+    document.removeEventListener('devicemotion', watchId);
+}
+
+var Accelerometer = {
+    getCurrentAcceleration: getCurrentAcceleration,
+    watchAcceleration: watchAcceleration,
+    clearWatch: clearWatch,
+};
+
+firefoxos.registerPlugin('Accelerometer', Accelerometer);


[5/6] git commit: fix acceleromter for firefox os

Posted by st...@apache.org.
fix acceleromter for firefox os


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/015e3f9b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/015e3f9b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/015e3f9b

Branch: refs/heads/dev
Commit: 015e3f9b134849f29af08aca54cb1adf701bda41
Parents: fcc626a
Author: James Long <lo...@gmail.com>
Authored: Mon Oct 21 17:47:05 2013 -0400
Committer: James Long <lo...@gmail.com>
Committed: Mon Oct 21 17:47:05 2013 -0400

----------------------------------------------------------------------
 src/firefoxos/accelerometer.js | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/015e3f9b/src/firefoxos/accelerometer.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/accelerometer.js b/src/firefoxos/accelerometer.js
index 5ba0b7d..d2fa658 100644
--- a/src/firefoxos/accelerometer.js
+++ b/src/firefoxos/accelerometer.js
@@ -1,15 +1,15 @@
 
 var Accelerometer = {
-    start: function start(successCallback, errorCallback) {
-        console.log('start watching accelerometer');
-        function accelerationCallback(deviceMotionEvent) {
-            successCallback(deviceMotionEvent.acceleration);
-        }
-        return document.addEventListener('devicemotion', accelerationCallback, false);
+    start: function start(success, error) {
+        return window.addEventListener('devicemotion', function(ev) {
+            var acc = ev.accelerationIncludingGravity;
+            acc.timestamp = new Date().getTime();
+            success(ev.accelerationIncludingGravity);
+        }, false);
     },
-    stop: function stop(watchId) {
-        console.log('stop watching acecelerometer');
-        document.removeEventListener('devicemotion', watchId);
+
+    stop: function stop() {
+        window.removeEventListener('devicemotion');
     }
 };
 


[4/6] git commit: update firefoxos integration

Posted by st...@apache.org.
update firefoxos integration


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/fcc626a8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/fcc626a8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/fcc626a8

Branch: refs/heads/dev
Commit: fcc626a8ae049e7fe3a9322cafde6477da92204e
Parents: 53a2e82
Author: James Long <lo...@gmail.com>
Authored: Fri Oct 18 00:15:26 2013 -0400
Committer: James Long <lo...@gmail.com>
Committed: Fri Oct 18 00:15:26 2013 -0400

----------------------------------------------------------------------
 src/firefoxos/accelerometer.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/fcc626a8/src/firefoxos/accelerometer.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/accelerometer.js b/src/firefoxos/accelerometer.js
index b0f8b70..5ba0b7d 100644
--- a/src/firefoxos/accelerometer.js
+++ b/src/firefoxos/accelerometer.js
@@ -1,5 +1,3 @@
-var firefoxos = require('cordova/platform');
-
 
 var Accelerometer = {
     start: function start(successCallback, errorCallback) {
@@ -15,4 +13,5 @@ var Accelerometer = {
     }
 };
 
-firefoxos.registerPlugin('Accelerometer', Accelerometer);
+module.exports = Accelerometer;
+require('cordova/firefoxos/commandProxy').add('Accelerometer', Accelerometer);


[2/6] git commit: accelerometer registers, but is not responding

Posted by st...@apache.org.
accelerometer registers, but is not responding


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/3dad5222
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/3dad5222
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/3dad5222

Branch: refs/heads/dev
Commit: 3dad522215752b086ed106f82d4f6792750e82fe
Parents: 6d3a17b
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Fri Sep 20 12:22:47 2013 +0200
Committer: Piotr Zalewa <pi...@zalewa.info>
Committed: Fri Sep 20 12:22:47 2013 +0200

----------------------------------------------------------------------
 src/firefoxos/accelerometer.js | 44 ++++++++-----------------------------
 1 file changed, 9 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/3dad5222/src/firefoxos/accelerometer.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/accelerometer.js b/src/firefoxos/accelerometer.js
index bde8acc..696f1e5 100644
--- a/src/firefoxos/accelerometer.js
+++ b/src/firefoxos/accelerometer.js
@@ -1,44 +1,18 @@
 var firefoxos = require('cordova/platform');
 
-// initiate watching the acceleration and clear it straight afterwards
-function getCurrentAcceleration(accelerometerSuccess, accelerometerError) {
-    var listener = document.addEventListener('devicemotion', accelerationCallback, false);
-    function accelerationCallback(deviceMotionEvent) {
-        accelerometerSuccess(deviceMotionEvent.acceleration);
-        document.removeEventListener('devicemotion', listener, false);
-    }
-}
 
-// listen to acceleration and call accelerometerSuccess every x milliseconds
-function watchAcceleration(accelerometerSuccess, accelerometerError, options) {
-    // last timestamp when callback was called
-    var hit = 0;
-    var frequency = 0;
-    if (options && options.frequency) {
-        frequency = options.frequency;
-    }
-    function accelerationCallback(deviceMotionEvent) {
-        var newHit;
-        if (frequency) {
-          newHit = new Date().getTime();
-        }
-        if (!frequency || newHit >= hit + frequency) {
-            // return acceleration object instead of event
+var Accelerometer = {
+    start: function start(accelerometerSuccess, accelerometerError) {
+        console.log('start watching acecelerometer');
+        function accelerationCallback(deviceMotionEvent) {
             accelerometerSuccess(deviceMotionEvent.acceleration);
-            hit = newHit;
         }
+        return document.addEventListener('devicemotion', accelerationCallback, false);
+    },
+    stop: function stop(watchId) {
+        console.log('stop watching acecelerometer');
+        document.removeEventListener('devicemotion', watchId);
     }
-    return document.removeEventListener('devicemotion', accelerationCallback, false);
-}
-
-function clearWatch(watchId) {
-    document.removeEventListener('devicemotion', watchId);
-}
-
-var Accelerometer = {
-    getCurrentAcceleration: getCurrentAcceleration,
-    watchAcceleration: watchAcceleration,
-    clearWatch: clearWatch,
 };
 
 firefoxos.registerPlugin('Accelerometer', Accelerometer);


[3/6] git commit: fixed callbacks

Posted by st...@apache.org.
fixed callbacks


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/53a2e822
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/53a2e822
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/53a2e822

Branch: refs/heads/dev
Commit: 53a2e8225e8a36e86860af048b78fbd630111057
Parents: 3dad522
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Sat Sep 28 12:02:43 2013 +0200
Committer: Piotr Zalewa <pi...@zalewa.info>
Committed: Sat Sep 28 12:02:43 2013 +0200

----------------------------------------------------------------------
 src/firefoxos/accelerometer.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/53a2e822/src/firefoxos/accelerometer.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/accelerometer.js b/src/firefoxos/accelerometer.js
index 696f1e5..b0f8b70 100644
--- a/src/firefoxos/accelerometer.js
+++ b/src/firefoxos/accelerometer.js
@@ -2,10 +2,10 @@ var firefoxos = require('cordova/platform');
 
 
 var Accelerometer = {
-    start: function start(accelerometerSuccess, accelerometerError) {
-        console.log('start watching acecelerometer');
+    start: function start(successCallback, errorCallback) {
+        console.log('start watching accelerometer');
         function accelerationCallback(deviceMotionEvent) {
-            accelerometerSuccess(deviceMotionEvent.acceleration);
+            successCallback(deviceMotionEvent.acceleration);
         }
         return document.addEventListener('devicemotion', accelerationCallback, false);
     },


[6/6] git commit: Merge branch 'master' of github.com:jlongster/cordova-plugin-device-motion into dev

Posted by st...@apache.org.
Merge branch 'master' of github.com:jlongster/cordova-plugin-device-motion into dev


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/9db09502
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/9db09502
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/9db09502

Branch: refs/heads/dev
Commit: 9db09502ee73e09e0bf478179b64df353de0bc52
Parents: 3576342 015e3f9
Author: Steven Gill <st...@gmail.com>
Authored: Mon Oct 21 16:27:35 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Mon Oct 21 16:27:35 2013 -0700

----------------------------------------------------------------------
 plugin.xml                     | 13 +++++++++++++
 src/firefoxos/accelerometer.js | 17 +++++++++++++++++
 2 files changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/9db09502/plugin.xml
----------------------------------------------------------------------