You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2012/08/24 23:57:39 UTC
[44/50] [abbrv] js commit: booting version of cordova.qnx.js
booting version of cordova.qnx.js
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/2a0ca87b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/2a0ca87b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/2a0ca87b
Branch: refs/heads/master
Commit: 2a0ca87b2e11fb410aa97bee299ee78deb841f8b
Parents: 366572a
Author: Gord Tanner <gt...@gmail.com>
Authored: Tue Aug 21 15:49:56 2012 -0400
Committer: Anis Kadri <an...@gmail.com>
Committed: Fri Aug 24 13:49:59 2012 -0700
----------------------------------------------------------------------
Jakefile | 1 +
build/packager.js | 4 +-
lib/scripts/bootstrap-qnx.js | 3 ++
lib/webworks/qnx/platform.js | 6 +++++
lib/webworks/qnx/plugin/manager.js | 26 +++++++++++++++++++++
lib/webworks/qnx/plugin/qnx/accelerometer.js | 22 +++++++++++++++++
lib/webworks/qnx/plugin/qnx/device.js | 20 ++++++++++++++++
lib/webworks/qnx/plugin/qnx/network.js | 8 ++++++
8 files changed, 88 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/2a0ca87b/Jakefile
----------------------------------------------------------------------
diff --git a/Jakefile b/Jakefile
index 7abbbcf..f8bf5c9 100644
--- a/Jakefile
+++ b/Jakefile
@@ -71,6 +71,7 @@ task('build', ['clean', 'hint'], function () {
packager.generate("windows8",commitId);
packager.generate("blackberry",commitId);
packager.generate("playbook",commitId);
+ packager.generate("qnx",commitId);
packager.generate("ios",commitId);
packager.generate("wp7",commitId);
packager.generate("android",commitId);
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/2a0ca87b/build/packager.js
----------------------------------------------------------------------
diff --git a/build/packager.js b/build/packager.js
index 5fcdc17..0011575 100644
--- a/build/packager.js
+++ b/build/packager.js
@@ -31,10 +31,10 @@ packager.bundle = function(platform, debug, commitId ) {
modules[''] = 'lib/cordova.js'
- if (['playbook', 'blackberry'].indexOf(platform) > -1) {
+ if (['playbook', 'blackberry', 'qnx'].indexOf(platform) > -1) {
//BlackBerry is special ;)
- var lang;
+ var lang = platform;
switch (platform) {
case 'blackberry':
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/2a0ca87b/lib/scripts/bootstrap-qnx.js
----------------------------------------------------------------------
diff --git a/lib/scripts/bootstrap-qnx.js b/lib/scripts/bootstrap-qnx.js
new file mode 100644
index 0000000..8a5efbf
--- /dev/null
+++ b/lib/scripts/bootstrap-qnx.js
@@ -0,0 +1,3 @@
+document.addEventListener("webworksready", function () {
+ require('cordova/channel').onNativeReady.fire();
+});
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/2a0ca87b/lib/webworks/qnx/platform.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/platform.js b/lib/webworks/qnx/platform.js
new file mode 100644
index 0000000..83cf116
--- /dev/null
+++ b/lib/webworks/qnx/platform.js
@@ -0,0 +1,6 @@
+module.exports = {
+ id: "qnx",
+ initialize: function () { },
+ objects: {
+ }
+};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/2a0ca87b/lib/webworks/qnx/plugin/manager.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/manager.js b/lib/webworks/qnx/plugin/manager.js
new file mode 100644
index 0000000..e652866
--- /dev/null
+++ b/lib/webworks/qnx/plugin/manager.js
@@ -0,0 +1,26 @@
+var cordova = require('cordova'),
+ plugins = {
+ 'NetworkStatus' : require('cordova/plugin/qnx/network'),
+ 'Accelerometer' : require('cordova/plugin/qnx/accelerometer'),
+ 'Device' : require('cordova/plugin/qnx/device')
+ };
+
+module.exports = {
+ exec: function (win, fail, clazz, action, args) {
+ var result = {"status" : cordova.callbackStatus.CLASS_NOT_FOUND_EXCEPTION, "message" : "Class " + clazz + " cannot be found"};
+
+ if (plugins[clazz]) {
+ if (plugins[clazz][action]) {
+ result = plugins[clazz][action](args, win, fail);
+ }
+ else {
+ result = { "status" : cordova.callbackStatus.INVALID_ACTION, "message" : "Action not found: " + action };
+ }
+ }
+
+ return result;
+ },
+ resume: function () {},
+ pause: function () {},
+ destroy: function () {}
+};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/2a0ca87b/lib/webworks/qnx/plugin/qnx/accelerometer.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/qnx/accelerometer.js b/lib/webworks/qnx/plugin/qnx/accelerometer.js
new file mode 100644
index 0000000..68f1183
--- /dev/null
+++ b/lib/webworks/qnx/plugin/qnx/accelerometer.js
@@ -0,0 +1,22 @@
+var cordova = require('cordova'),
+ callback;
+
+module.exports = {
+ start: function (args, win, fail) {
+ window.removeEventListener("devicemotion", callback);
+ callback = function (motion) {
+ win({
+ x: motion.accelerationIncludingGravity.x,
+ y: motion.accelerationIncludingGravity.y,
+ z: motion.accelerationIncludingGravity.z,
+ timestamp: motion.timestamp
+ });
+ };
+ window.addEventListener("devicemotion", callback);
+ return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
+ },
+ stop: function (args, win, fail) {
+ window.removeEventListener("devicemotion", callback);
+ return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
+ }
+};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/2a0ca87b/lib/webworks/qnx/plugin/qnx/device.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/qnx/device.js b/lib/webworks/qnx/plugin/qnx/device.js
new file mode 100644
index 0000000..1907c72
--- /dev/null
+++ b/lib/webworks/qnx/plugin/qnx/device.js
@@ -0,0 +1,20 @@
+var channel = require('cordova/channel'),
+ cordova = require('cordova');
+
+// Tell cordova channel to wait on the CordovaInfoReady event
+channel.waitForInitialization('onCordovaInfoReady');
+
+module.exports = {
+ getDeviceInfo : function(args, win, fail){
+ win({
+ platform: "PlayBook",
+ version: blackberry.system.softwareVersion,
+ name: "Dev Alpha",
+ uuid: blackberry.identity.uuid,
+ cordova: "2.0.0"
+ });
+
+ return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "Device info returned" };
+ }
+
+};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/2a0ca87b/lib/webworks/qnx/plugin/qnx/network.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/qnx/network.js b/lib/webworks/qnx/plugin/qnx/network.js
new file mode 100644
index 0000000..164196c
--- /dev/null
+++ b/lib/webworks/qnx/plugin/qnx/network.js
@@ -0,0 +1,8 @@
+var cordova = require('cordova'),
+ connection = require('cordova/plugin/Connection');
+
+module.exports = {
+ getConnectionInfo: function (args, win, fail) {
+ return { "status": cordova.callbackStatus.OK, "message": blackberry.connection.type};
+ }
+};