You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by gt...@apache.org on 2012/11/15 19:56:27 UTC

js commit: Normalizing BlackBerry device information

Updated Branches:
  refs/heads/master 75eb826d1 -> 57dcbcc16


Normalizing BlackBerry device information


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/57dcbcc1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/57dcbcc1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/57dcbcc1

Branch: refs/heads/master
Commit: 57dcbcc162ae2a56526b0a2a131212801d82b617
Parents: 75eb826
Author: Gord Tanner <gt...@gmail.com>
Authored: Thu Nov 15 13:55:54 2012 -0500
Committer: Gord Tanner <gt...@gmail.com>
Committed: Thu Nov 15 13:55:54 2012 -0500

----------------------------------------------------------------------
 lib/blackberry/plugin/air/device.js |   88 ++++++++++++++++--------------
 lib/blackberry/plugin/qnx/device.js |    2 +-
 2 files changed, 48 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/57dcbcc1/lib/blackberry/plugin/air/device.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/device.js b/lib/blackberry/plugin/air/device.js
index 42003c0..bd89ee1 100644
--- a/lib/blackberry/plugin/air/device.js
+++ b/lib/blackberry/plugin/air/device.js
@@ -1,41 +1,47 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-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: blackberry.system.model,
-            uuid: blackberry.identity.PIN,
-            cordova: "2.2.0"
-        });
-
-        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "Device info returned" };
-    }
-
-};
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+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){
+        //Register an event handler for the networkChange event
+        var callback = blackberry.events.registerEventHandler("deviceInfo", function (info) {
+                win({
+                    platform: "BlackBerry",
+                    version: info.version,
+                    name: "PlayBook",
+                    uuid: info.uuid,
+                    cordova: "2.2.0"
+                });
+            }),
+            request = new blackberry.transport.RemoteFunctionCall("org/apache/cordova/getDeviceInfo"); 
+            
+        request.addParam("id", callback);
+        request.makeSyncCall();
+
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "" };
+    }
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/57dcbcc1/lib/blackberry/plugin/qnx/device.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/qnx/device.js b/lib/blackberry/plugin/qnx/device.js
index ca21d68..a8cbb1f 100644
--- a/lib/blackberry/plugin/qnx/device.js
+++ b/lib/blackberry/plugin/qnx/device.js
@@ -28,7 +28,7 @@ channel.waitForInitialization('onCordovaInfoReady');
 module.exports = {
     getDeviceInfo : function(args, win, fail){
         win({
-            platform: "BB10",
+            platform: "BlackBerry",
             version: blackberry.system.softwareVersion,
             name: "Dev Alpha",
             uuid: blackberry.identity.uuid,