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/03/28 20:50:49 UTC

[1/3] bada commit: more renaming

Updated Branches:
  refs/heads/master a7ea36dee -> d3ab54272


more renaming


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

Branch: refs/heads/master
Commit: d3ab5427236abd53027517e15610037ec4b4de83
Parents: a7ea36d
Author: Anis Kadri <an...@gmail.com>
Authored: Wed Mar 28 11:50:37 2012 -0700
Committer: Anis Kadri <an...@gmail.com>
Committed: Wed Mar 28 11:50:37 2012 -0700

----------------------------------------------------------------------
 LICENSE                       |  202 +++++++++++
 README.md                     |    2 +-
 Res/cordova/accelerometer.js  |  117 +++++++
 Res/cordova/camera.js         |   90 +++++
 Res/cordova/compass.js        |   56 +++
 Res/cordova/contact.js        |  342 ++++++++++++++++++
 Res/cordova/cordova.base.js   |  549 +++++++++++++++++++++++++++++
 Res/cordova/cordova.bat       |    1 +
 Res/cordova/debugconsole.js   |  105 ++++++
 Res/cordova/device.js         |   25 ++
 Res/cordova/file.js           |  670 ++++++++++++++++++++++++++++++++++++
 Res/cordova/geolocation.js    |  140 ++++++++
 Res/cordova/network.js        |   58 +++
 Res/cordova/notification.js   |  105 ++++++
 Res/cordova/position.js       |   62 ++++
 Res/phonegap/accelerometer.js |  117 -------
 Res/phonegap/camera.js        |   90 -----
 Res/phonegap/compass.js       |   56 ---
 Res/phonegap/contact.js       |  342 ------------------
 Res/phonegap/debugconsole.js  |  105 ------
 Res/phonegap/device.js        |   25 --
 Res/phonegap/file.js          |  670 ------------------------------------
 Res/phonegap/geolocation.js   |  140 --------
 Res/phonegap/network.js       |   58 ---
 Res/phonegap/notification.js  |  105 ------
 Res/phonegap/phonegap.base.js |  549 -----------------------------
 Res/phonegap/phonegap.bat     |    1 -
 Res/phonegap/position.js      |   62 ----
 src/Accelerometer.cpp         |    6 +-
 src/Compass.cpp               |    6 +-
 src/Contacts.cpp              |    6 +-
 src/DebugConsole.cpp          |    2 +-
 src/Device.cpp                |    2 +-
 src/GeoLocation.cpp           |    6 +-
 src/Kamera.cpp                |    2 +-
 src/Network.cpp               |    2 +-
 src/Notification.cpp          |    6 +-
 src/WebForm.cpp               |   16 +-
 38 files changed, 2550 insertions(+), 2348 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/d3ab5427/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..7a4a3ea
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/d3ab5427/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index e66bc6f..92f5573 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ Steps to build a Cordova app
 1. Download Source Code (clone the repository)
 2. Import in bada C++ IDE
 3. Put your HTML/CSS files in the Res/ folder
-4. Run phonegap.bat under Res/phonegap directory
+4. Run cordova.bat under Res/cordova directory
 5. Build&Run!
 
 Runnning in the simulator

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/d3ab5427/Res/cordova/accelerometer.js
----------------------------------------------------------------------
diff --git a/Res/cordova/accelerometer.js b/Res/cordova/accelerometer.js
new file mode 100644
index 0000000..9941beb
--- /dev/null
+++ b/Res/cordova/accelerometer.js
@@ -0,0 +1,117 @@
+/*
+ * Cordova is available under *either* the terms of the modified BSD license *or* the
+ * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
+ * 
+ * Copyright (c) 2005-2010, Nitobi Software Inc.
+ * Copyright (c) 2010, IBM Corporation
+ */
+function Acceleration(x, y, z, timestamp) {
+  this.x = x;
+  this.y = y;
+  this.z = z;
+  this.timestamp = timestamp || new Date().getTime();
+};
+
+/**
+ * Class provides access to device accelerometer data.
+ * @constructor
+ */
+function Accelerometer() {
+
+    /**
+     * The last known acceleration.  type=Acceleration()
+     */
+    this.lastAcceleration = null;
+    this.id = null;
+};
+
+/**
+ * Asynchronously acquires the current acceleration.
+ *
+ * @param {Function} successCallback    The function to call when the acceleration data is available
+ * @param {Function} errorCallback      The function to call when there is an error getting the acceleration data. (OPTIONAL)
+ * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL)
+ */
+Accelerometer.prototype.getCurrentAcceleration = function(successCallback, errorCallback, options) {
+
+    // successCallback required
+    if (typeof successCallback != "function") {
+        console.log("Accelerometer Error: successCallback is not a function");
+        return;
+    }
+
+    // errorCallback optional
+    if (errorCallback && (typeof errorCallback != "function")) {
+        console.log("Accelerometer Error: errorCallback is not a function");
+        return;
+    }
+
+    // Get acceleration
+    Cordova.exec(successCallback, errorCallback, "com.cordova.Accelerometer", "getCurrentAcceleration", []);
+};
+
+/**
+ * Asynchronously acquires the device acceleration at a given interval.
+ *
+ * @param {Function} successCallback    The function to call each time the acceleration data is available
+ * @param {Function} errorCallback      The function to call when there is an error getting the acceleration data. (OPTIONAL)
+ * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL)
+ * @return String                       The watch id that must be passed to #clearWatch to stop watching.
+ */
+Accelerometer.prototype.watchAcceleration = function(successCallback, errorCallback, options) {
+
+    // Default interval (10 sec)
+    var frequency = (options != undefined) ? options.frequency : 10000;
+
+    // successCallback required
+    if (typeof successCallback != "function") {
+        console.log("Accelerometer Error: successCallback is not a function");
+        return;
+    }
+
+    // errorCallback optional
+    if (errorCallback && (typeof errorCallback != "function")) {
+        console.log("Accelerometer Error: errorCallback is not a function");
+        return;
+    }
+    // Start watch timer
+    this.id = Cordova.createUUID();
+    Cordova.exec(successCallback, errorCallback, "com.cordova.Accelerometer", "watchAcceleration", []);
+    return this.id;
+};
+
+/**
+ * Clears the specified accelerometer watch.
+ *
+ * @param {String} id The id of the watch returned from #watchAcceleration.
+ */
+Accelerometer.prototype.clearWatch = function(id) {
+
+    // Stop javascript timer & remove from timer list
+    if (id == this.id) {
+        Cordova.exec(null, null, "com.cordova.Accelerometer", "clearWatch", []);
+    }
+};
+
+/*
+ * Native callback when watchAcceleration has a new acceleration.
+ */
+Accelerometer.prototype.success = function(id, result) {
+	try {
+        var accel = new Acceleration(result.x, result.y, result.z, result.timestamp);
+        navigator.accelerometer.lastAcceleration = accel;
+        navigator.accelerometer.listeners[id].success(accel);
+    }
+    catch (e) {
+        debugPrint("Geolocation Error: "+e.message);
+        console.log("Geolocation Error: Error calling success callback function.");
+    }
+
+    if (id == "global") {
+        delete navigator.accelerometer.listeners["global"];
+    }
+};
+
+Cordova.addConstructor(function() {
+    if (typeof navigator.accelerometer == "undefined") navigator.accelerometer = new Accelerometer();
+});

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/d3ab5427/Res/cordova/camera.js
----------------------------------------------------------------------
diff --git a/Res/cordova/camera.js b/Res/cordova/camera.js
new file mode 100644
index 0000000..3258f22
--- /dev/null
+++ b/Res/cordova/camera.js
@@ -0,0 +1,90 @@
+
+/*
+ * Cordova is available under *either* the terms of the modified BSD license *or* the
+ * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
+ * 
+ * Copyright (c) 2005-2010, Nitobi Software Inc.
+ * Copyright (c) 2010, IBM Corporation
+ */
+
+/**
+ * This class provides access to the device camera.
+ *
+ * @constructor
+ */
+Camera = function() {
+    this.options = null;
+};
+
+/**
+ * Format of image that returned from getPicture.
+ *
+ * Example: navigator.camera.getPicture(success, fail,
+ *              { quality: 80,
+ *                destinationType: Camera.DestinationType.DATA_URL,
+ *                sourceType: Camera.PictureSourceType.PHOTOLIBRARY})
+ */
+Camera.DestinationType = {
+    DATA_URL: 0,                // Return base64 encoded string
+    FILE_URI: 1                 // Return file URI
+};
+Camera.prototype.DestinationType = Camera.DestinationType;
+
+/**
+ * Source to getPicture from.
+ *
+ * Example: navigator.camera.getPicture(success, fail,
+ *              { quality: 80,
+ *                destinationType: Camera.DestinationType.DATA_URL,
+ *                sourceType: Camera.PictureSourceType.PHOTOLIBRARY})
+ */
+Camera.PictureSourceType = {    // Ignored on Blackberry
+    PHOTOLIBRARY : 0,           // Choose image from picture library 
+    CAMERA : 1,                 // Take picture from camera
+    SAVEDPHOTOALBUM : 2         // Choose image from picture library 
+};
+Camera.prototype.PictureSourceType = Camera.PictureSourceType;
+
+/**
+ * Gets a picture from source defined by "options.sourceType", and returns the
+ * image as defined by the "options.destinationType" option.
+
+ * The defaults are sourceType=CAMERA and destinationType=DATA_URL.
+ *
+ * @param {Function} successCallback
+ * @param {Function} errorCallback
+ * @param {Object} options
+ */
+Camera.prototype.getPicture = function(successCallback, errorCallback, options) {
+
+    // successCallback required
+    if (typeof successCallback != "function") {
+        console.log("Camera Error: successCallback is not a function");
+        return;
+    }
+
+    // errorCallback optional
+    if (errorCallback && (typeof errorCallback != "function")) {
+        console.log("Camera Error: errorCallback is not a function");
+        return;
+    }
+
+    this.options = options;
+    var quality = 80;
+    if (options.quality) {
+        quality = this.options.quality;
+    }
+    var destinationType = Camera.DestinationType.DATA_URL;
+    if (this.options.destinationType) {
+        destinationType = this.options.destinationType;
+    }
+    var sourceType = Camera.PictureSourceType.CAMERA;
+    if (typeof this.options.sourceType == "number") {
+        sourceType = this.options.sourceType;
+    }
+    Cordova.exec(successCallback, errorCallback, "com.cordova.Camera", "getPicture", [quality, destinationType, sourceType]);
+};
+
+Cordova.addConstructor(function() {
+	if (typeof navigator.camera == "undefined") navigator.camera = new Camera();
+});

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/d3ab5427/Res/cordova/compass.js
----------------------------------------------------------------------
diff --git a/Res/cordova/compass.js b/Res/cordova/compass.js
new file mode 100644
index 0000000..b300e39
--- /dev/null
+++ b/Res/cordova/compass.js
@@ -0,0 +1,56 @@
+/**
+ * This class provides access to device Compass data.
+ * @constructor
+ */
+function Compass() {
+    /**
+     * The last known Compass position.
+     */
+  this.uuid = null;
+};
+
+/**
+ * Asynchronously aquires the current heading.
+ * @param {Function} successCallback The function to call when the heading
+ * data is available
+ * @param {Function} errorCallback The function to call when there is an error 
+ * getting the heading data.
+ * @param {PositionOptions} options The options for getting the heading data
+ * such as timeout.
+ */
+Compass.prototype.getCurrentHeading = function(successCallback, errorCallback, options) {
+  Cordova.exec(successCallback, errorCallback, "com.cordova.Compass", "getCurrentHeading", options);
+};
+
+/**
+ * Asynchronously aquires the heading repeatedly at a given interval.
+ * @param {Function} successCallback The function to call each time the heading
+ * data is available
+ * @param {Function} errorCallback The function to call when there is an error 
+ * getting the heading data.
+ * @param {HeadingOptions} options The options for getting the heading data
+ * such as timeout and the frequency of the watch.
+ */
+Compass.prototype.watchHeading= function(successCallback, errorCallback, options) {
+  this.uuid = Cordova.createUUID();
+  Cordova.exec(successCallback, errorCallback, "com.cordova.Compass", "watchHeading", [this.uuid, options.frequency || 3000]);
+  return this.uuid;
+};
+
+
+/**
+ * Clears the specified heading watch.
+ * @param {String} watchId The ID of the watch returned from #watchHeading.
+ */
+Compass.prototype.clearWatch = function(watchId) {
+    if(this.uuid == watchId) {
+      Cordova.exec(null, null, "com.cordova.Compass", "clearWatch", [this.uuid]);
+      this.uuid = null;
+    } else {
+      debugPrint('no clear watch');
+    }
+};
+
+Cordova.addConstructor(function() {
+    if (typeof navigator.compass == "undefined") navigator.compass = new Compass();
+});

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/d3ab5427/Res/cordova/contact.js
----------------------------------------------------------------------
diff --git a/Res/cordova/contact.js b/Res/cordova/contact.js
new file mode 100644
index 0000000..9f43907
--- /dev/null
+++ b/Res/cordova/contact.js
@@ -0,0 +1,342 @@
+/*
+ * Cordova is available under *either* the terms of the modified BSD license *or* the
+ * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
+ *
+ * Copyright (c) 2005-2010, Nitobi Software Inc.
+ * Copyright (c) 2010, IBM Corporation
+ */
+
+/**
+* Contains information about a single contact.
+* @param {DOMString} id unique identifier
+* @param {DOMString} displayName
+* @param {ContactName} name
+* @param {DOMString} nickname
+* @param {ContactField[]} phoneNumbers array of phone numbers
+* @param {ContactField[]} emails array of email addresses
+* @param {ContactAddress[]} addresses array of addresses
+* @param {ContactField[]} ims instant messaging user ids
+* @param {ContactOrganization[]} organizations
+* @param {DOMString} revision date contact was last updated
+* @param {DOMString} birthday contact's birthday
+* @param {DOMString} gender contact's gender
+* @param {DOMString} note user notes about contact
+* @param {ContactField[]} photos
+* @param {ContactField[]} urls contact's web sites
+* @param {DOMString} timezone UTC time zone offset
+*/
+
+var Contact = function(id, displayName, name, nickname, phoneNumbers, emails, addresses,
+    ims, organizations, revision, birthday, gender, note, photos, categories, urls, timezone) {
+    this.id = id || null;
+    this.displayName = displayName || null;
+    this.name = name || null; // ContactName
+    this.nickname = nickname || null;
+    this.phoneNumbers = phoneNumbers || null; // ContactField[]
+    this.emails = emails || null; // ContactField[]
+    this.addresses = addresses || null; // ContactAddress[]
+    this.ims = ims || null; // ContactField[]
+    this.organizations = organizations || null; // ContactOrganization[]
+    this.revision = revision || null; // JS Date
+    this.birthday = birthday || null; // JS Date
+    this.gender = gender || null;
+    this.note = note || null;
+    this.photos = photos || null; // ContactField[]
+    this.categories = categories || null; 
+    this.urls = urls || null; // ContactField[]
+    this.timezone = timezone || null;
+};
+
+/**
+* Removes contact from device storage.
+* @param successCB success callback
+* @param errorCB error callback (optional)
+*/
+Contact.prototype.remove = function(successCB, errorCB) {
+	if (this.id == null) {
+    var errorObj = new ContactError();
+    errorObj.code = ContactError.NOT_FOUND_ERROR;
+    errorCB(errorObj);
+  }
+  else {
+      Cordova.exec(successCB, errorCB, "com.cordova.Contacts", "remove", [this.id]);
+  }
+};
+/**
+* Bada ONLY
+* displays contact via Bada Contact UI
+*
+* @param errorCB error callback
+*/
+Contact.prototype.display = function(successCB, errorCB, options) { 
+	if (this.id == null) {
+    var errorObj = new ContactError();
+    errorObj.code = ContactError.NOT_FOUND_ERROR;
+    errorCB(errorObj);
+  }
+  else {
+      Cordova.exec(successCB, errorCB, "com.cordova.Contacts","displayContact", [this.id, options]);
+  }
+};
+
+/**
+* Creates a deep copy of this Contact.
+* With the contact ID set to null.
+* @return copy of this Contact
+*/
+Contact.prototype.clone = function() {
+    var clonedContact = Cordova.clone(this);
+    clonedContact.id = null;
+    // Loop through and clear out any id's in phones, emails, etc.
+    if (clonedContact.phoneNumbers) {
+    	for (i=0; i<clonedContact.phoneNumbers.length; i++) {
+    		clonedContact.phoneNumbers[i].id = null;
+    	}
+    }
+    if (clonedContact.emails) {
+    	for (i=0; i<clonedContact.emails.length; i++) {
+    		clonedContact.emails[i].id = null;
+    	}
+    }
+    if (clonedContact.addresses) {
+    	for (i=0; i<clonedContact.addresses.length; i++) {
+    		clonedContact.addresses[i].id = null;
+    	}
+    }
+    if (clonedContact.ims) {
+    	for (i=0; i<clonedContact.ims.length; i++) {
+    		clonedContact.ims[i].id = null;
+    	}
+    }
+    if (clonedContact.organizations) {
+    	for (i=0; i<clonedContact.organizations.length; i++) {
+    		clonedContact.organizations[i].id = null;
+    	}
+    }
+    if (clonedContact.photos) {
+    	for (i=0; i<clonedContact.photos.length; i++) {
+    		clonedContact.photos[i].id = null;
+    	}
+    }
+    if (clonedContact.urls) {
+    	for (i=0; i<clonedContact.urls.length; i++) {
+    		clonedContact.urls[i].id = null;
+    	}
+    }
+    return clonedContact;
+};
+
+/**
+* Persists contact to device storage.
+* @param successCB success callback
+* @param errorCB error callback - optional
+*/
+Contact.prototype.save = function(successCB, errorCB) {
+  // Read by Bada to create contact
+  var id = navigator.service.contacts.records.push(this) - 1;
+	Cordova.exec(successCB, errorCB, "com.cordova.Contacts", "save", [id]);
+};
+
+/**
+* Contact name.
+* @param formatted
+* @param familyName
+* @param givenName
+* @param middle
+* @param prefix
+* @param suffix
+*/
+var ContactName = function(formatted, familyName, givenName, middle, prefix, suffix) {
+    this.formatted = formatted != "undefined" ? formatted : null;
+    this.familyName = familyName != "undefined" ? familyName : null;
+    this.givenName = givenName != "undefined" ? givenName : null;
+    this.middleName = middle != "undefined" ? middle : null;
+    this.honorificPrefix = prefix != "undefined" ? prefix : null;
+    this.honorificSuffix = suffix != "undefined" ? suffix : null;
+};
+
+/**
+* Generic contact field.
+* @param type
+* @param value
+* @param primary
+* @param id
+*/
+var ContactField = function(type, value, pref, id) {
+    this.type = type != "undefined" ? type : null;
+    this.value = value != "undefined" ? value : null;
+    this.pref = pref != "undefined" ? pref : null;
+    this.id = id != "undefined" ? id : null;
+};
+
+/**
+* Contact address.
+* @param formatted
+* @param streetAddress
+* @param locality
+* @param region
+* @param postalCode
+* @param country
+*/
+var ContactAddress = function(formatted, streetAddress, locality, region, postalCode, country, id) {
+    this.formatted = formatted != "undefined" ? formatted : null;
+    this.streetAddress = streetAddress != "undefined" ? streetAddress : null;
+    this.locality = locality != "undefined" ? locality : null;
+    this.region = region != "undefined" ? region : null;
+    this.postalCode = postalCode != "undefined" ? postalCode : null;
+    this.country = country != "undefined" ? country : null;
+    this.id = id != "undefined" ? id : null;
+};
+
+/**
+* Contact organization.
+* @param name
+* @param dept
+* @param title
+* @param startDate
+* @param endDate
+* @param location
+* @param desc
+*/
+var ContactOrganization = function(name, dept, title, startDate, endDate, location, desc) {
+    this.name = name != "undefined" ? name : null;
+    this.department = dept != "undefined" ? dept : null;
+    this.title = title != "undefined" ? title : null;
+    this.startDate = startDate != "undefined" ? startDate : null;
+    this.endDate = endDate != "undefined" ? endDate : null;
+    this.location = location != "undefined" ? location : null;
+    this.description = desc != "undefined" ? desc : null;
+};
+
+/**
+* Contact account.
+* @param domain
+* @param username
+* @param userid
+*/
+var ContactAccount = function(domain, username, userid) {
+    this.domain = domain != "undefined" ? domain : null;
+    this.username = username != "undefined" ? username : null;
+    this.userid = userid != "undefined" ? userid : null;
+}
+
+/**
+* Represents a group of Contacts.
+*/
+var Contacts = function() {
+    this.inProgress = false;
+    this.records = new Array(); // used by bada to create contacts
+    this.results = new Array(); // used by bada to update contact results
+    this.resultsCallback = null;
+    this.errorCallback = null;
+};
+/**
+* Returns an array of Contacts matching the search criteria.
+* @param fields that should be searched
+* @param successCB success callback
+* @param errorCB error callback (optional)
+* @param {ContactFindOptions} options that can be applied to contact searching
+* @return array of Contacts matching search criteria
+*/
+Contacts.prototype.find = function(fields, successCB, errorCB, options) {
+  /* fields searched are: displayName, Email, Phone Number, User Id
+   * other fields are ignored
+   */
+	Cordova.exec(successCB, errorCB, "com.cordova.Contacts","find",[options.filter]);
+};
+
+/**
+* need to turn the JSON string representing contact object into actual object
+* @param JSON string with contact data
+* Call stored results function with  Contact object
+*/
+Contacts.prototype._findCallback = function(contact)
+{
+	if(contact) {
+		try {
+      this.results.push(this.create(contact));
+		} catch(e){
+			console.log("Error parsing contact");
+		}
+	}
+};
+/** 
+* Need to return an error object rather than just a single error code
+* @param error code
+* Call optional error callback if found.
+* Called from objective c find, remove, and save methods on error.
+*/
+Contacts.prototype._errCallback = function(pluginResult)
+{
+	var errorObj = new ContactError();
+   	errorObj.code = pluginResult.message;
+	pluginResult.message = errorObj;
+	return pluginResult;
+};
+// Bada only api to create a new contact via the GUI
+Contacts.prototype.newContactUI = function(successCallback) { 
+    Cordova.exec(successCallback, null, "com.cordova.Contacts","newContact", []);
+};
+// Bada only api to select a contact via the GUI
+Contacts.prototype.chooseContact = function(successCallback, options) {
+    Cordova.exec(successCallback, null, "com.cordova.Contacts","chooseContact", options);
+};
+
+
+/**
+* This function creates a new contact, but it does not persist the contact
+* to device storage. To persist the contact to device storage, invoke
+* contact.save().
+* @param properties an object who's properties will be examined to create a new Contact
+* @returns new Contact object
+*/
+Contacts.prototype.create = function(properties) {
+    var contact = new Contact();
+    for (i in properties) {
+        if (contact[i]!='undefined') {
+            contact[i]=properties[i];
+        }
+    }
+    return contact;
+};
+
+/**
+ * ContactFindOptions.
+ * @param filter used to match contacts against
+ * @param multiple boolean used to determine if more than one contact should be returned
+ * @param updatedSince return only contact records that have been updated on or after the given time
+ */
+var ContactFindOptions = function(filter, multiple, updatedSince) {
+    this.filter = filter || '';
+    this.multiple = multiple || true;
+    this.updatedSince = updatedSince || '';
+};
+
+/**
+ *  ContactError.
+ *  An error code assigned by an implementation when an error has occurred
+ */
+var ContactError = function() {
+    this.code=null;
+};
+
+/**
+ * Error codes
+ */
+ContactError.UNKNOWN_ERROR = 0;
+ContactError.INVALID_ARGUMENT_ERROR = 1;
+ContactError.NOT_FOUND_ERROR = 2;
+ContactError.TIMEOUT_ERROR = 3;
+ContactError.PENDING_OPERATION_ERROR = 4;
+ContactError.IO_ERROR = 5;
+ContactError.NOT_SUPPORTED_ERROR = 6;
+ContactError.PERMISSION_DENIED_ERROR = 20;
+
+/**
+ * Add the contact interface into the browser.
+ */
+Cordova.addConstructor(function() { 
+    if(typeof navigator.service == "undefined") navigator.service = new Object();
+    if(typeof navigator.service.contacts == "undefined") navigator.service.contacts = new Contacts();
+});
+

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/d3ab5427/Res/cordova/cordova.base.js
----------------------------------------------------------------------
diff --git a/Res/cordova/cordova.base.js b/Res/cordova/cordova.base.js
new file mode 100644
index 0000000..aa08214
--- /dev/null
+++ b/Res/cordova/cordova.base.js
@@ -0,0 +1,549 @@
+
+/*
+ * Cordova is available under *either* the terms of the modified BSD license *or* the
+ * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
+ * 
+ * Copyright (c) 2005-2010, Nitobi Software Inc.
+ * Copyright (c) 2010, IBM Corporation
+ */
+
+/**
+ * The order of events during page load and Cordova startup is as follows:
+ *
+ * onDOMContentLoaded         Internal event that is received when the web page is loaded and parsed.
+ * window.onload              Body onload event.
+ * onNativeReady              Internal event that indicates the Cordova native side is ready.
+ * onCordovaInit             Internal event that kicks off creation of all Cordova JavaScript objects (runs constructors).
+ * onCordovaReady            Internal event fired when all Cordova JavaScript objects have been created
+ * onCordovaInfoReady        Internal event fired when device properties are available
+ * onDeviceReady              User event fired to indicate that Cordova is ready
+ * onResume                   User event fired to indicate a start/resume lifecycle event
+ *
+ * The only Cordova events that user code should register for are:
+ *      onDeviceReady
+ *      onResume
+ *
+ * Listeners can be registered as:
+ *      document.addEventListener("deviceready", myDeviceReadyListener, false);
+ *      document.addEventListener("resume", myResumeListener, false);
+ */
+
+function debugPrint(body) {
+    var list = document.getElementById("debuglist");
+    var item = document.createElement("li");
+    item.appendChild(document.createTextNode(body));
+    list.appendChild(item);
+}
+/**
+ * This represents the Cordova API itself, and provides a global namespace for accessing
+ * information about the state of Cordova.
+ * @class
+ */
+Cordova = { 
+   queue: {
+        ready: true,
+        commands: [],
+        timer: null
+    },
+    _constructors: []
+};
+
+/**
+ * Boolean flag indicating if the Cordova API is available and initialized.
+ */ // TODO: Remove this, it is unused here ... -jm
+Cordova.available = function() {
+  return window.device.uuid != undefined;
+}
+
+/**
+ * Custom pub-sub channel that can have functions subscribed to it
+ */
+Cordova.Channel = function(type)
+{
+    this.type = type;
+    this.handlers = {};
+    this.guid = 0;
+    this.fired = false;
+    this.enabled = true;
+};
+
+/**
+ * Subscribes the given function to the channel. Any time that 
+ * Channel.fire is called so too will the function.
+ * Optionally specify an execution context for the function
+ * and a guid that can be used to stop subscribing to the channel.
+ * Returns the guid.
+ */
+Cordova.Channel.prototype.subscribe = function(f, c, g) {
+    // need a function to call
+    if (f == null) { return; }
+
+    var func = f;
+    if (typeof c == "object" && f instanceof Function) { func = Cordova.close(c, f); }
+
+    g = g || func.observer_guid || f.observer_guid || this.guid++;
+    func.observer_guid = g;
+    f.observer_guid = g;
+    this.handlers[g] = func;
+    return g;
+};
+
+/**
+ * Like subscribe but the function is only called once and then it
+ * auto-unsubscribes itself.
+ */
+Cordova.Channel.prototype.subscribeOnce = function(f, c) {
+    var g = null;
+    var _this = this;
+    var m = function() {
+        f.apply(c || null, arguments);
+        _this.unsubscribe(g);
+    }
+    if (this.fired) {
+        if (typeof c == "object" && f instanceof Function) { f = Cordova.close(c, f); }
+        f.apply(this, this.fireArgs);
+    } else {
+        g = this.subscribe(m);
+    }
+    return g;
+};
+
+/** 
+ * Unsubscribes the function with the given guid from the channel.
+ */
+Cordova.Channel.prototype.unsubscribe = function(g) {
+    if (g instanceof Function) { g = g.observer_guid; }
+    this.handlers[g] = null;
+    delete this.handlers[g];
+};
+
+/** 
+ * Calls all functions subscribed to this channel.
+ */
+Cordova.Channel.prototype.fire = function(e) {
+    if (this.enabled) {
+        var fail = false;
+        for (var item in this.handlers) {
+            var handler = this.handlers[item];
+            if (handler instanceof Function) {
+                var rv = (handler.apply(this, arguments)==false);
+                fail = fail || rv;
+            }
+        }
+        this.fired = true;
+        this.fireArgs = arguments;
+        return !fail;
+    }
+    return true;
+};
+
+/**
+ * Calls the provided function only after all of the channels specified
+ * have been fired.
+ */
+Cordova.Channel.join = function(h, c) {
+    var i = c.length;
+    var f = function() {
+        if (!(--i)) h();
+    }
+    for (var j=0; j<i; j++) {
+        (!c[j].fired?c[j].subscribeOnce(f):i--);
+    }
+    if (!i) h();
+};
+
+/**
+ * Add an initialization function to a queue that ensures it will run and initialize
+ * application constructors only once Cordova has been initialized.
+ * @param {Function} func The function callback you want run once Cordova is initialized
+ */
+Cordova.addConstructor = function(func) {
+    Cordova.onCordovaInit.subscribeOnce(function() {
+        // try {
+            func();
+        // } catch(e) {
+        //     if (typeof(debug['log']) == 'function') {
+        //         debug.log("Failed to run constructor: " + debug.processMessage(e));
+        //     } else {
+        //         alert("Failed to run constructor: " + e.message);
+        //     }
+        // }
+    });
+};
+
+/**
+ * Plugins object.
+ */
+if (!window.plugins) {
+    window.plugins = {};
+}
+
+/**
+ * Adds new plugin object to window.plugins.
+ * The plugin is accessed using window.plugins.<name>
+ * 
+ * @param name      The plugin name
+ * @param obj       The plugin object
+ */
+Cordova.addPlugin = function(name, obj) {
+    if (!window.plugins[name]) {
+        window.plugins[name] = obj;
+    }
+    else {
+        console.log("Plugin " + name + " already exists.");
+    }
+};
+
+/**
+ * onDOMContentLoaded channel is fired when the DOM content 
+ * of the page has been parsed.
+ */
+Cordova.onDOMContentLoaded = new Cordova.Channel('onDOMContentLoaded');
+
+/**
+ * onNativeReady channel is fired when the Cordova native code
+ * has been initialized.
+ */
+Cordova.onNativeReady = new Cordova.Channel('onNativeReady');
+
+/**
+ * onCordovaInit channel is fired when the web page is fully loaded and
+ * Cordova native code has been initialized.
+ */
+Cordova.onCordovaInit = new Cordova.Channel('onCordovaInit');
+
+/**
+ * onCordovaReady channel is fired when the JS Cordova objects have been created.
+ */
+Cordova.onCordovaReady = new Cordova.Channel('onCordovaReady');
+
+/**
+ * onCordovaInfoReady channel is fired when the Cordova device properties
+ * has been set.
+ */
+Cordova.onCordovaInfoReady = new Cordova.Channel('onCordovaInfoReady');
+
+/**
+ * onResume channel is fired when the Cordova native code
+ * resumes.
+ */
+Cordova.onResume = new Cordova.Channel('onResume');
+
+/**
+ * onPause channel is fired when the Cordova native code
+ * pauses.
+ */
+Cordova.onPause = new Cordova.Channel('onPause');
+
+// _nativeReady is global variable that the native side can set
+// to signify that the native code is ready. It is a global since 
+// it may be called before any Cordova JS is ready.
+if (typeof _nativeReady !== 'undefined') { Cordova.onNativeReady.fire(); }
+
+/**
+ * onDeviceReady is fired only after all Cordova objects are created and
+ * the device properties are set.
+ */
+Cordova.onDeviceReady = new Cordova.Channel('onDeviceReady');
+
+/**
+ * Create all Cordova objects once page has fully loaded and native side is ready.
+ */
+Cordova.Channel.join(function() {
+
+    // Run Cordova constructors
+    Cordova.onCordovaInit.fire();
+
+    // Fire event to notify that all objects are created
+    Cordova.onCordovaReady.fire();
+
+}, [ Cordova.onDOMContentLoaded, Cordova.onNativeReady ]);
+
+/**
+ * Fire onDeviceReady event once all constructors have run and Cordova info has been
+ * received from native side.
+ */
+Cordova.Channel.join(function() {
+    Cordova.onDeviceReady.fire();
+    
+    // Fire the onresume event, since first one happens before JavaScript is loaded
+    Cordova.onResume.fire();
+}, [ Cordova.onCordovaReady, Cordova.onCordovaInfoReady]);
+
+// Listen for DOMContentLoaded and notify our channel subscribers
+document.addEventListener('DOMContentLoaded', function() {
+    Cordova.onDOMContentLoaded.fire();
+}, false);
+
+// Intercept calls to document.addEventListener and watch for deviceready
+Cordova.m_document_addEventListener = document.addEventListener;
+
+document.addEventListener = function(evt, handler, capture) {
+    var e = evt.toLowerCase();
+    if (e == 'deviceready') {
+        Cordova.onDeviceReady.subscribeOnce(handler);
+    } else if (e == 'resume') {
+        Cordova.onResume.subscribe(handler);
+        // if subscribing listener after event has already fired, invoke the handler
+        if (Cordova.onResume.fired && handler instanceof Function) {
+            handler();
+        }
+    } else if (e == 'pause') {
+        Cordova.onPause.subscribe(handler);
+    } else {
+        Cordova.m_document_addEventListener.call(document, evt, handler, capture);
+    }
+};
+
+Cordova.m_element_addEventListener = Element.prototype.addEventListener;
+
+/**
+ * For BlackBerry, the touchstart event does not work so we need to do click
+ * events when touchstart events are attached.
+ */
+Element.prototype.addEventListener = function(evt, handler, capture) {
+    if (evt === 'touchstart') {
+        evt = 'click';
+    }
+    Cordova.m_element_addEventListener.call(this, evt, handler, capture);
+};
+
+/**
+ * Does a deep clone of the object.
+ *
+ * @param obj
+ * @return
+ */
+Cordova.clone = function(obj) {
+    if(!obj) { 
+        return obj;
+    }
+    
+    if(obj instanceof Array){
+        var retVal = new Array();
+        for(var i = 0; i < obj.length; ++i){
+            retVal.push(Cordova.clone(obj[i]));
+        }
+        return retVal;
+    }
+    
+    if (obj instanceof Function) {
+        return obj;
+    }
+    
+    if(!(obj instanceof Object)){
+        return obj;
+    }
+    
+    if(obj instanceof Date){
+        return obj;
+    }
+
+    retVal = new Object();
+    for(i in obj){
+        if(!(i in retVal) || retVal[i] != obj[i]) {
+            retVal[i] = Cordova.clone(obj[i]);
+        }
+    }
+    return retVal;
+};
+
+Cordova.close = function(context, func, params) {
+    if (typeof params === 'undefined') {
+        return function() {
+            return func.apply(context, arguments);
+        }
+    } else {
+        return function() {
+            return func.apply(context, params);
+        }
+    }
+};
+
+Cordova.callbackId = 0;
+Cordova.callbacks  = {};
+Cordova.callbackStatus = {
+    NO_RESULT: 0,
+    OK: 1,
+    CLASS_NOT_FOUND_EXCEPTION: 2,
+    ILLEGAL_ACCESS_EXCEPTION: 3,
+    INSTANTIATION_EXCEPTION: 4,
+    MALFORMED_URL_EXCEPTION: 5,
+    IO_EXCEPTION: 6,
+    INVALID_ACTION: 7,
+    JSON_EXCEPTION: 8,
+    ERROR: 9
+};
+
+/**
+ * Called by native code when returning successful result from an action.
+ *
+ * @param callbackId
+ * @param args
+ */
+Cordova.callbackSuccess = function(callbackId, args) {
+    if (Cordova.callbacks[callbackId]) {
+
+        // If result is to be sent to callback
+        if (args.status == Cordova.callbackStatus.OK) {
+            try {
+                if (Cordova.callbacks[callbackId].success) {
+                    Cordova.callbacks[callbackId].success(args.message);
+                }
+            }
+            catch (e) {
+                console.log("Error in success callback: "+callbackId+" = "+e);
+            }
+        }
+
+        // Clear callback if not expecting any more results
+        if (!args.keepCallback) {
+            delete Cordova.callbacks[callbackId];
+        }
+    }
+};
+
+/**
+ * Called by native code when returning error result from an action.
+ *
+ * @param callbackId
+ * @param args
+ */
+Cordova.callbackError = function(callbackId, args) {
+    if (Cordova.callbacks[callbackId]) {
+        try {
+            if (Cordova.callbacks[callbackId].fail) {
+                Cordova.callbacks[callbackId].fail(args.message);
+            }
+        }
+        catch (e) {
+            console.log("Error in error callback: "+callbackId+" = "+e);
+        }
+
+        // Clear callback if not expecting any more results
+        if (!args.keepCallback) {
+            delete Cordova.callbacks[callbackId];
+        }
+    }
+};
+
+/**
+ * Create a UUID
+ *
+ * @return
+ */
+Cordova.createUUID = function() {
+    return Cordova.UUIDcreatePart(4) + '-' +
+        Cordova.UUIDcreatePart(2) + '-' +
+        Cordova.UUIDcreatePart(2) + '-' +
+        Cordova.UUIDcreatePart(2) + '-' +
+        Cordova.UUIDcreatePart(6);
+};
+
+Cordova.UUIDcreatePart = function(length) {
+    var uuidpart = "";
+    for (var i=0; i<length; i++) {
+        var uuidchar = parseInt((Math.random() * 256)).toString(16);
+        if (uuidchar.length == 1) {
+            uuidchar = "0" + uuidchar;
+        }
+        uuidpart += uuidchar;
+    }
+    return uuidpart;
+};
+/**
+ * Execute a Cordova command in a queued fashion, to ensure commands do not
+ * execute with any race conditions, and only run when Cordova is ready to
+ * receive them.
+ *
+ */
+Cordova.exec = function() { 
+	
+    Cordova.queue.commands.push(arguments);
+    if (Cordova.queue.timer == null)
+        Cordova.queue.timer = setInterval(Cordova.run_command, 10);
+};
+
+/**
+ * Internal function used to dispatch the request to Cordova.  It processes the
+ * command queue and executes the next command on the list.  Simple parameters are passed
+ * as arguments on the url.  JavaScript objects converted into a JSON string and passed as a
+ * query string argument of the url.
+ * Arguments may be in one of two formats:
+ *   FORMAT ONE (preferable)
+ * The native side will call Cordova.callbackSuccess or Cordova.callbackError,
+ * depending upon the result of the action.
+ *
+ * @param {Function} success    The success callback
+ * @param {Function} fail       The fail callback
+ * @param {String} service      The name of the service to use
+ * @param {String} action		The name of the action to use
+ * @param {String[]} [args]     Zero or more arguments to pass to the method
+ *  	
+ * FORMAT TWO
+ * @param {String} command Command to be run in Cordova, e.g. "ClassName.method"
+ * @param {String[]} [args] Zero or more arguments to pass to the method
+ * object parameters are passed as an array object [object1, object2] each object will be passed as JSON strings 
+ * @private
+ */
+Cordova.run_command = function() {
+    if (!Cordova.available() || !Cordova.queue.ready)
+        return;
+
+    var args = Cordova.queue.commands.shift();
+    if (Cordova.queue.commands.length == 0) {
+        clearInterval(Cordova.queue.timer);
+        Cordova.queue.timer = null;
+    }
+	
+	var service;
+	var callbackId = null;
+	var start=0;
+    try {
+ 		if (args[0] == null || typeof args[0] === "function") {
+ 			var success = args[0];
+ 			var fail = args[1];
+ 			service = args[2] + "." + args[3];
+			args = args[4];  //array of arguments to 
+      if (success || fail) {
+          callbackId = service + Cordova.callbackId++;
+          Cordova.callbacks[callbackId] = {success:success, fail:fail};
+      }
+ 		} else { 
+ 			service = args[0]; 
+ 			start = 1;
+ 		}
+        
+      var uri = [];
+      var query = [];
+    	for (var i = start; i < args.length; i++) {
+        	var arg = args[i];
+        	if (arg == undefined || arg == null)
+            	continue;
+        	if (typeof(arg) == 'object') {
+              for(i in arg) {
+                if(typeof(arg[i]) != 'object') {
+                  query.push(encodeURIComponent(i) + '=' + encodeURIComponent(arg[i]));
+                }
+              }
+          }
+        	else {
+            	uri.push(encodeURIComponent(arg));
+          }
+    	}
+    	var next = callbackId != null  ?  ("/" + callbackId + "/") : "/";
+    	var url = "gap://" + service + next + uri.join("/");
+
+    	if (query.length > 0) {
+        	url += "?" + query.join("&");
+    	}
+      Cordova.queue.ready = false;
+      document.location = url;
+   
+    } catch (e) {
+        console.log("CordovaExec Error: "+e);
+    }
+    
+
+};
+

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/d3ab5427/Res/cordova/cordova.bat
----------------------------------------------------------------------
diff --git a/Res/cordova/cordova.bat b/Res/cordova/cordova.bat
new file mode 100755
index 0000000..16e7ef2
--- /dev/null
+++ b/Res/cordova/cordova.bat
@@ -0,0 +1 @@
+copy /B cordova.base.js+geolocation.js+position.js+accelerometer.js+network.js+debugconsole.js+contact.js+device.js+compass.js+notification.js+camera.js cordova.js

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/d3ab5427/Res/cordova/debugconsole.js
----------------------------------------------------------------------
diff --git a/Res/cordova/debugconsole.js b/Res/cordova/debugconsole.js
new file mode 100644
index 0000000..8c84de1
--- /dev/null
+++ b/Res/cordova/debugconsole.js
@@ -0,0 +1,105 @@
+/**
+ * This class provides access to the debugging console.
+ * @constructor
+ */
+function DebugConsole(isDeprecated) {
+    this.logLevel = DebugConsole.INFO_LEVEL;
+    this.isDeprecated = isDeprecated ? true : false;
+}
+
+// from most verbose, to least verbose
+DebugConsole.ALL_LEVEL    = 1; // same as first level
+DebugConsole.INFO_LEVEL   = 1;
+DebugConsole.WARN_LEVEL   = 2;
+DebugConsole.ERROR_LEVEL  = 4;
+DebugConsole.NONE_LEVEL   = 8;
+													
+DebugConsole.prototype.setLevel = function(level) {
+    this.logLevel = level;
+}
+
+/**
+ * Utility function for rendering and indenting strings, or serializing
+ * objects to a string capable of being printed to the console.
+ * @param {Object|String} message The string or object to convert to an indented string
+ * @private
+ */
+DebugConsole.prototype.processMessage = function(message, maxDepth) {
+	if (maxDepth === undefined) maxDepth = 0;
+    if (typeof(message) != 'object') {
+        return (this.isDeprecated ? "WARNING: debug object is deprecated, please use console object " + message : message);
+    } else {
+        /**
+         * @function
+         * @ignore
+         */
+        function indent(str) {
+            return str.replace(/^/mg, "    ");
+        }
+        /**
+         * @function
+         * @ignore
+         */
+        function makeStructured(obj, depth) {
+            var str = "";
+            for (var i in obj) {
+                try {
+                    if (typeof(obj[i]) == 'object' && depth < maxDepth) {
+                        str += i + ": " + indent(makeStructured(obj[i])) + "   ";
+                    } else {
+                        str += i + " = " + indent(String(obj[i])).replace(/^    /, "") + "   ";
+                    }
+                } catch(e) {
+                    str += i + " = EXCEPTION: " + e.message + "   ";
+                }
+            }
+            return str;
+        }
+        
+        return ((this.isDeprecated ? "WARNING: debug object is deprecated, please use console object   " :  "") + "Object: " + makeStructured(message, maxDepth));
+    }
+};
+
+/**
+ * Print a normal log message to the console
+ * @param {Object|String} message Message or object to print to the console
+ */
+DebugConsole.prototype.log = function(message, maxDepth) {
+    if (Cordova.available && this.logLevel <= DebugConsole.INFO_LEVEL)
+        Cordova.exec(null, null, 'com.cordova.DebugConsole', 'log',
+            [this.processMessage(message, maxDepth), 'INFO']
+        );
+    else
+        console.log(message);
+};
+
+/**
+ * Print a warning message to the console
+ * @param {Object|String} message Message or object to print to the console
+ */
+DebugConsole.prototype.warn = function(message, maxDepth) {
+    if (Cordova.available && this.logLevel <= DebugConsole.WARN_LEVEL)
+        Cordova.exec(null, null, 'com.cordova.DebugConsole', 'log',
+            [this.processMessage(message, maxDepth), 'WARN']
+        );
+    else
+        console.error(message);
+};
+
+/**
+ * Print an error message to the console
+ * @param {Object|String} message Message or object to print to the console
+ */
+DebugConsole.prototype.error = function(message, maxDepth) {
+    if (Cordova.available && this.logLevel <= DebugConsole.ERROR_LEVEL)
+        Cordova.exec(null, null, 'com.cordova.DebugConsole', 'log',
+            [this.processMessage(message, maxDepth), 'ERROR']
+        );
+    else
+        console.error(message);
+};
+
+Cordova.addConstructor(function() {
+    window.console = new DebugConsole();
+    window.debug = new DebugConsole(true);
+});

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/d3ab5427/Res/cordova/device.js
----------------------------------------------------------------------
diff --git a/Res/cordova/device.js b/Res/cordova/device.js
new file mode 100644
index 0000000..9769e62
--- /dev/null
+++ b/Res/cordova/device.js
@@ -0,0 +1,25 @@
+
+/*
+ * Cordova is available under *either* the terms of the modified BSD license *or* the
+ * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
+ * 
+ * Copyright (c) 2005-2010, Nitobi Software Inc.
+ * Copyright (c) 2010, IBM Corporation
+ */
+
+/**
+ * This represents the mobile device, and provides properties for inspecting the model, version, UUID of the
+ * phone, etc.
+ * @constructor
+ */
+function Device() {
+  this.platform = null;
+  this.version  = null;
+  this.name     = null;
+  this.uuid     = null;
+};
+
+Cordova.addConstructor(function() {
+  navigator.device = window.device = window.device || new Device();
+  Cordova.onCordovaInfoReady.fire();
+});

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/d3ab5427/Res/cordova/file.js
----------------------------------------------------------------------
diff --git a/Res/cordova/file.js b/Res/cordova/file.js
new file mode 100644
index 0000000..7406349
--- /dev/null
+++ b/Res/cordova/file.js
@@ -0,0 +1,670 @@
+
+/*
+ * Cordova is available under *either* the terms of the modified BSD license *or* the
+ * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
+ * 
+ * Copyright (c) 2005-2010, Nitobi Software Inc.
+ * Copyright (c) 2010, IBM Corporation
+ */
+
+/**
+ * These classes provides generic read and write access to the mobile device file system.
+ * They are not used to read files from a server.
+ */
+
+/**
+ * Contains properties that describe a file.
+ */
+function FileProperties(filePath) {
+    this.filePath = filePath;
+    this.size = 0;
+    this.lastModifiedDate = null;
+};
+
+/**
+ * FileError
+ */
+function FileError() {
+    this.code = null;
+};
+
+// File error codes
+// Found in DOMException
+FileError.NOT_FOUND_ERR = 1;
+FileError.SECURITY_ERR = 2;
+FileError.ABORT_ERR = 3;
+
+// Added by File API specification
+FileError.NOT_READABLE_ERR = 4;
+FileError.ENCODING_ERR = 5;
+FileError.NO_MODIFICATION_ALLOWED_ERR = 6;
+FileError.INVALID_STATE_ERR = 7;
+FileError.SYNTAX_ERR = 8;
+FileError.INVALID_MODIFICATION_ERR = 9;
+FileError.QUOTA_EXCEEDED_ERR = 10;
+FileError.TYPE_MISMATCH_ERR = 11;
+FileError.PATH_EXISTS_ERR = 12;
+
+//-----------------------------------------------------------------------------
+//File manager
+//-----------------------------------------------------------------------------
+
+/**
+ * This class provides read and write access to mobile device file system in 
+ * support of FileReader and FileWriter APIs based on 
+ * http://www.w3.org/TR/2010/WD-FileAPI-20101026
+ * and
+ * <writer url>
+ */
+function FileMgr() {
+};
+
+/**
+ * Returns the root file system paths.
+ * 
+ * @return {String[]} array of root file system paths
+ */
+FileMgr.prototype.getRootPaths = function() {
+    return blackberry.io.dir.getRootDirs();
+};
+
+/**
+ * Returns the available memory in bytes for the root file system of the specified file path.
+ * 
+ * @param filePath          A file system path
+ */
+FileMgr.prototype.getFreeDiskSpace = function(filePath) {
+    return blackberry.io.dir.getFreeSpaceForRoot(filePath);
+};
+
+/**
+ * Reads a file from the device and encodes the contents using the specified 
+ * encoding. 
+ * 
+ * @param fileName          The full path of the file to read
+ * @param encoding          The encoding to use to encode the file's content
+ * @param successCallback   Callback invoked with file contents
+ * @param errorCallback     Callback invoked on error
+ */
+FileMgr.prototype.readAsText = function(fileName, encoding, successCallback, errorCallback) {
+    Cordova.exec(successCallback, errorCallback, "File", "readAsText", [fileName, encoding]);
+};
+
+/**
+ * Reads a file from the device and encodes the contents using BASE64 encoding.  
+ * 
+ * @param fileName          The full path of the file to read.
+ * @param successCallback   Callback invoked with file contents
+ * @param errorCallback     Callback invoked on error
+ */
+FileMgr.prototype.readAsDataURL = function(fileName, successCallback, errorCallback) {
+    Cordova.exec(successCallback, errorCallback, "File", "readAsDataURL", [fileName]);
+};
+
+/**
+ * Writes data to the specified file.
+ * 
+ * @param fileName          The full path of the file to write
+ * @param data              The data to be written
+ * @param position          The position in the file to begin writing
+ * @param successCallback   Callback invoked after successful write operation
+ * @param errorCallback     Callback invoked on error
+ */
+FileMgr.prototype.write = function(fileName, data, position, successCallback, errorCallback) {
+    Cordova.exec(successCallback, errorCallback, "File", "write", [fileName, data, position]);
+};
+
+/**
+ * Tests whether file exists.  Will return false if the path specifies a directory.
+ * 
+ * @param fullPath             The full path of the file 
+ */
+FileMgr.prototype.testFileExists = function(fullPath) {
+    return blackberry.io.file.exists(fullPath);
+};
+
+/**
+ * Tests whether directory exists.  Will return false if the path specifies a file.
+ * 
+ * @param fullPath             The full path of the directory
+ */
+FileMgr.prototype.testDirectoryExists = function(fullPath) {
+    return blackberry.io.dir.exists(fullPath);
+};
+
+/**
+ * Gets the properties of a file.  Throws an exception if fileName is a directory.
+ * 
+ * @param fileName          The full path of the file 
+ */
+FileMgr.prototype.getFileProperties = function(fileName) {    
+    var fileProperties = new FileProperties(fileName);
+    // attempt to get file properties
+    if (blackberry.io.file.exists(fileName)) {
+        var props = blackberry.io.file.getFileProperties(fileName);
+        fileProperties.size = props.size;
+        fileProperties.lastModifiedDate = props.dateModified;
+    }
+    // fileName is a directory
+    else if (blackberry.io.dir.exists(fileName)) {
+        throw FileError.TYPE_MISMATCH_ERR;
+    }
+    return fileProperties;
+};
+
+/**
+ * Changes the length of the specified file.  Data beyond new length is discarded.  
+ * 
+ * @param fileName          The full path of the file to truncate
+ * @param size              The size to which the length of the file is to be adjusted
+ * @param successCallback   Callback invoked after successful write operation
+ * @param errorCallback     Callback invoked on error
+ */
+FileMgr.prototype.truncate = function(fileName, size, successCallback, errorCallback) {
+    Cordova.exec(successCallback, errorCallback, "File", "truncate", [fileName, size]);
+};
+
+/**
+ * Removes a file from the file system.
+ * 
+ * @param fileName          The full path of the file to be deleted
+ */
+FileMgr.prototype.deleteFile = function(fileName) {
+    // delete file, if it exists
+    if (blackberry.io.file.exists(fileName)) {
+        blackberry.io.file.deleteFile(fileName);
+    }
+    // fileName is a directory
+    else if (blackberry.io.dir.exists(fileName)) {
+        throw FileError.TYPE_MISMATCH_ERR;
+    }
+    // fileName not found 
+    else {
+        throw FileError.NOT_FOUND_ERR;
+    }
+};
+
+/**
+ * Creates a directory on device storage.
+ * 
+ * @param dirName           The full path of the directory to be created
+ */
+FileMgr.prototype.createDirectory = function(dirName) {
+    if (!blackberry.io.dir.exists(dirName)) {
+        // createNewDir API requires trailing slash
+        if (dirName.substr(-1) !== "/") {
+            dirName += "/";
+        }
+        blackberry.io.dir.createNewDir(dirName);
+    }
+    // directory already exists
+    else {
+        throw FileError.PATH_EXISTS_ERR;
+    }
+};
+
+/**
+ * Deletes the specified directory from device storage.
+ * 
+ * @param dirName           The full path of the directory to be deleted
+ */
+FileMgr.prototype.deleteDirectory = function(dirName) {
+    blackberry.io.dir.deleteDirectory(dirName);
+};
+
+Cordova.addConstructor(function() {
+    if (typeof navigator.fileMgr == "undefined") navigator.fileMgr = new FileMgr();
+});
+
+//-----------------------------------------------------------------------------
+//File Reader
+//-----------------------------------------------------------------------------
+
+/**
+ * This class reads the mobile device file system.
+ */
+function FileReader() {
+    this.fileName = "";
+
+    this.readyState = 0;
+
+    // File data
+    this.result = null;
+
+    // Error
+    this.error = null;
+
+    // Event handlers
+    this.onloadstart = null;    // When the read starts.
+    this.onprogress = null;     // While reading (and decoding) file or fileBlob data, and reporting partial file data (progess.loaded/progress.total)
+    this.onload = null;         // When the read has successfully completed.
+    this.onerror = null;        // When the read has failed (see errors).
+    this.onloadend = null;      // When the request has completed (either in success or failure).
+    this.onabort = null;        // When the read has been aborted. For instance, by invoking the abort() method.
+};
+
+//States
+FileReader.EMPTY = 0;
+FileReader.LOADING = 1;
+FileReader.DONE = 2;
+
+/**
+ * Abort read file operation.
+ */
+FileReader.prototype.abort = function() {
+    var event;
+    
+    // reset everything
+    this.readyState = FileReader.DONE;
+    this.result = null;
+    
+    // set error
+    var error = new FileError();
+    error.code = error.ABORT_ERR;
+    this.error = error;
+
+    // abort procedure
+    if (typeof this.onerror == "function") {
+        event = {"type":"error", "target":this};
+        this.onerror(event);
+    }
+    if (typeof this.onabort == "function") {
+        event = {"type":"abort", "target":this};
+        this.onabort(event);
+    }
+    if (typeof this.onloadend == "function") {
+        event = {"type":"loadend", "target":this};
+        this.onloadend(event);
+    }
+};
+
+/**
+ * Reads and encodes text file.
+ *
+ * @param file          The name of the file
+ * @param encoding      [Optional] (see http://www.iana.org/assignments/character-sets)
+ */
+FileReader.prototype.readAsText = function(file, encoding) {
+    var event;
+    
+    // Use UTF-8 as default encoding
+    var enc = encoding ? encoding : "UTF-8";
+    
+    // start
+    this.readyState = FileReader.LOADING;
+    if (typeof this.onloadstart == "function") {
+        event = {"type":"loadstart", "target":this};
+        this.onloadstart(event);
+    }
+
+    // read and encode file
+    this.fileName = file;
+    var me = this;
+    navigator.fileMgr.readAsText(file, enc, 
+
+        // success callback
+        function(result) {
+            // If DONE (canceled), then don't do anything
+            if (me.readyState === FileReader.DONE) {
+                return;
+            }
+
+            // success procedure
+            me.result = result;
+            if (typeof me.onload == "function") {
+                event = {"type":"load", "target":me};
+                me.onload(event);
+            }
+            me.readyState = FileReader.DONE;
+            if (typeof me.onloadend == "function") {
+                event = {"type":"loadend", "target":me};
+                me.onloadend(event);
+            }
+        },
+
+        // error callback
+        function(error) {
+            // If DONE (canceled), then don't do anything
+            if (me.readyState === FileReader.DONE) {
+                return;
+            }
+
+            // capture error
+            var err = new FileError();
+            err.code = error;
+            me.error = err;
+            
+            // error procedure
+            me.result = null;
+            if (typeof me.onerror == "function") {
+                event = {"type":"error", "target":me};
+                me.onerror(event);
+            }
+            me.readyState = FileReader.DONE;
+            if (typeof me.onloadend == "function") {
+                event = {"type":"loadend", "target":me};
+                me.onloadend(event);
+            }
+        }
+    );
+};
+
+/**
+ * Read file and return data as a base64 encoded data url.
+ * A data url is of the form:
+ *      data:[<mediatype>][;base64],<data>
+ *
+ * @param file          The name of the file
+ */
+FileReader.prototype.readAsDataURL = function(file) {
+    var event;
+    
+    // start
+    this.readyState = FileReader.LOADING;
+    if (typeof this.onloadstart == "function") {
+        event = {"type":"loadstart", "target":this};
+        this.onloadstart(event);
+    }
+    
+    // read and encode file
+    this.fileName = file;
+    var me = this;
+    navigator.fileMgr.readAsDataURL(file, 
+
+        // success callback
+        function(result) {
+            // If DONE (canceled), then don't do anything
+            if (me.readyState === FileReader.DONE) {
+                return;
+            }
+
+            // success procedure
+            me.result = result;
+            if (typeof me.onload == "function") {
+                event = {"type":"load", "target":me};
+                me.onload(event);
+            }
+            me.readyState = FileReader.DONE;
+            if (typeof me.onloadend == "function") {
+                event = {"type":"loadend", "target":me};
+                me.onloadend(event);
+            }
+        },
+
+        // error callback
+        function(error) {
+            // If DONE (canceled), then don't do anything
+            if (me.readyState === FileReader.DONE) {
+                return;
+            }
+
+            // capture error
+            var err = new FileError();
+            err.code = error;
+            me.error = err;
+            
+            // error procedure
+            me.result = null;
+            if (typeof me.onerror == "function") {
+                event = {"type":"error", "target":me};
+                me.onerror(event);
+            }
+            me.readyState = FileReader.DONE;
+            if (typeof me.onloadend == "function") {
+                event = {"type":"loadend", "target":me};
+                me.onloadend(event);
+            }
+        }
+    );
+};
+
+//-----------------------------------------------------------------------------
+//File Writer
+//-----------------------------------------------------------------------------
+
+/**
+* This class writes to the mobile device file system.
+*
+* @param filePath       The full path to the file to be written to
+* @param append         If true, then data will be written to the end of the file rather than the beginning 
+*/
+function FileWriter(filePath, append) {
+    this.fileName = filePath;
+    this.length = 0;
+
+    // get the file properties
+    var fp = navigator.fileMgr.getFileProperties(filePath);
+    this.length = fp.size;
+    
+    // default is to write at the beginning of the file
+    this.position = (append !== true) ? 0 : this.length;
+    
+    this.readyState = 0; // EMPTY
+    
+    // Error
+    this.error = null;
+
+    // Event handlers
+    this.onwritestart = null;   // When writing starts
+    this.onprogress = null;     // While writing the file, and reporting partial file data
+    this.onwrite = null;        // When the write has successfully completed.
+    this.onwriteend = null;     // When the request has completed (either in success or failure).
+    this.onabort = null;        // When the write has been aborted. For instance, by invoking the abort() method.
+    this.onerror = null;        // When the write has failed (see errors).
+};
+
+//States
+FileWriter.INIT = 0;
+FileWriter.WRITING = 1;
+FileWriter.DONE = 2;
+
+/**
+ * Abort writing file.
+ */
+FileWriter.prototype.abort = function() {
+    var event;
+    // check for invalid state 
+    if (this.readyState === FileWriter.DONE || this.readyState === FileWriter.INIT) {
+        throw FileError.INVALID_STATE_ERR;
+    }
+    
+    // set error
+    var error = new FileError();
+    error.code = error.ABORT_ERR;
+    this.error = error;
+
+    // dispatch progress events
+    if (typeof this.onerror == "function") {
+        event = {"type":"error", "target":this};
+        this.onerror(event);
+    }
+    if (typeof this.onabort == "function") {
+        event = {"type":"abort", "target":this};
+        this.onabort(event);
+    }
+
+    // set state
+    this.readyState = FileWriter.DONE;
+    
+    // done
+    if (typeof this.writeend == "function") {
+        event = {"type":"writeend", "target":this};
+        this.writeend(event);
+    }
+};
+
+/**
+ * Sets the file position at which the next write will occur.
+ * 
+ * @param offset    Absolute byte offset into the file
+ */
+FileWriter.prototype.seek = function(offset) {
+    // Throw an exception if we are already writing a file
+    if (this.readyState === FileWriter.WRITING) {
+        throw FileError.INVALID_STATE_ERR;
+    }
+
+    if (!offset) {
+        return;
+    }
+    
+    // offset is bigger than file size, set to length of file
+    if (offset > this.length) { 
+        this.position = this.length;
+    }
+    // seek back from end of file
+    else if (offset < 0) { 
+        this.position = Math.max(offset + this.length, 0);
+    } 
+    // offset in the middle of file
+    else {
+        this.position = offset;
+    }
+};
+
+/**
+ * Truncates the file to the specified size.
+ * 
+ * @param size      The size to which the file length is to be adjusted
+ */
+FileWriter.prototype.truncate = function(size) {
+    var event;
+    
+    // Throw an exception if we are already writing a file
+    if (this.readyState === FileWriter.WRITING) {
+        throw FileError.INVALID_STATE_ERR;
+    }
+    
+    // start
+    this.readyState = FileWriter.WRITING;
+    if (typeof this.onwritestart == "function") {
+        event = {"type":"writestart", "target":this};
+        this.onwritestart(event);
+    }
+
+    // truncate file
+    var me = this;
+    navigator.fileMgr.truncate(this.fileName, size, 
+        // Success callback receives the new file size
+        function(result) {
+            // If DONE (canceled), then don't do anything
+            if (me.readyState === FileWriter.DONE) {
+                return;
+            }
+
+            // new file size is returned
+            me.length = result;
+            // position is lesser of old position or new file size
+            me.position = Math.min(me.position, result);
+
+            // success procedure
+            if (typeof me.onwrite == "function") {
+                event = {"type":"write", "target":me};
+                me.onwrite(event);
+            }
+            me.readyState = FileWriter.DONE;
+            if (typeof me.onwriteend == "function") {
+                event = {"type":"writeend", "target":me};
+                me.onwriteend(event);
+            }
+        },
+
+        // Error callback
+        function(error) {
+            // If DONE (canceled), then don't do anything
+            if (me.readyState === FileWriter.DONE) {
+                return;
+            }
+
+            // Save error
+            var err = new FileError();
+            err.code = error;
+            me.error = err;
+
+            // error procedure
+            if (typeof me.onerror == "function") {
+                event = {"type":"error", "target":me};
+                me.onerror(event);
+            }
+            me.readyState = FileWriter.DONE;
+            if (typeof me.onwriteend == "function") {
+                event = {"type":"writeend", "target":me};
+                me.onwriteend(event);
+            }
+        }            
+    );
+};
+
+/**
+ * Writes the contents of a file to the device.
+ * 
+ * @param data      contents to be written
+ */
+FileWriter.prototype.write = function(data) {
+    var event;
+    
+    // Throw an exception if we are already writing a file
+    if (this.readyState === FileWriter.WRITING) {
+        throw FileError.INVALID_STATE_ERR;
+    }
+
+    // WRITING state
+    this.readyState = FileWriter.WRITING;
+    if (typeof this.onwritestart == "function") {
+        event = {"type":"writestart", "target":this};
+        this.onwritestart(event);
+    }
+
+    // Write file
+    var me = this;
+    navigator.fileMgr.write(this.fileName, data, this.position,
+
+        // Success callback receives bytes written
+        function(result) {
+            // If DONE (canceled), then don't do anything
+            if (me.readyState === FileWriter.DONE) {
+                return;
+            }
+
+            // new length is maximum of old length, or position plus bytes written
+            me.length = Math.max(me.length, me.position + result);
+            // position always increases by bytes written because file would be extended
+            me.position += result;
+
+            // success procedure
+            if (typeof me.onwrite == "function") {
+                event = {"type":"write", "target":me};
+                me.onwrite(event);
+            }
+            me.readyState = FileWriter.DONE;
+            if (typeof me.onwriteend == "function") {
+                event = {"type":"writeend", "target":me};
+                me.onwriteend(event);
+            }
+        },
+
+        // Error callback
+        function(error) {
+            // If DONE (canceled), then don't do anything
+            if (me.readyState === FileWriter.DONE) {
+                return;
+            }
+
+            // Save error
+            var err = new FileError();
+            err.code = error;
+            me.error = err;
+
+            // error procedure
+            if (typeof me.onerror == "function") {
+                event = {"type":"error", "target":me};
+                me.onerror(event);
+            }
+            me.readyState = FileWriter.DONE;
+            if (typeof me.onwriteend == "function") {
+                event = {"type":"writeend", "target":me};
+                me.onwriteend(event);
+            }
+        }
+    );
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/d3ab5427/Res/cordova/geolocation.js
----------------------------------------------------------------------
diff --git a/Res/cordova/geolocation.js b/Res/cordova/geolocation.js
new file mode 100644
index 0000000..7b57b2e
--- /dev/null
+++ b/Res/cordova/geolocation.js
@@ -0,0 +1,140 @@
+
+/*
+ * Cordova is available under *either* the terms of the modified BSD license *or* the
+ * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
+ * 
+ * Copyright (c) 2005-2010, Nitobi Software Inc.
+ * Copyright (c) 2010, IBM Corporation
+ */
+
+/**
+ * This class provides access to device GPS data.
+ * @constructor
+ */
+function Geolocation() {
+
+    // The last known GPS position.
+    this.lastPosition = null;
+    this.id = null;
+};
+
+/**
+ * Position error object
+ *
+ * @param code
+ * @param message
+ */
+function PositionError(code, message) {
+    this.code = code || 0;
+    this.message = message || '';
+};
+
+PositionError.UNKNOWN_ERROR = 0;
+PositionError.PERMISSION_DENIED = 1;
+PositionError.POSITION_UNAVAILABLE = 2;
+PositionError.TIMEOUT = 3;
+
+/**
+ * Asynchronously aquires the current position.
+ *
+ * @param {Function} successCallback    The function to call when the position data is available
+ * @param {Function} errorCallback      The function to call when there is an error getting the heading position. (OPTIONAL)
+ * @param {PositionOptions} options     The options for getting the position data. (OPTIONAL)
+ */
+Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallback, options) {
+    this.id = Cordova.createUUID();
+    // default maximumAge value should be 0, and set if positive 
+    var maximumAge = 0;
+
+    // default timeout value should be infinity, but that's a really long time
+    var timeout = 3600000; 
+
+    var enableHighAccuracy = false;
+    if (options) {
+        if (options.maximumAge && (options.maximumAge > 0)) {
+            maximumAge = options.maximumAge;
+        }
+        if (options.enableHighAccuracy) {
+            enableHighAccuracy = options.enableHighAccuracy;
+        }
+        if (options.timeout) {
+            timeout = (options.timeout < 0) ? 0 : options.timeout;
+        }
+    }
+    Cordova.exec(successCallback, errorCallback, "com.cordova.Geolocation", "getCurrentPosition", [maximumAge, timeout, enableHighAccuracy]);
+}
+
+/**
+ * Asynchronously watches the geolocation for changes to geolocation.  When a change occurs,
+ * the successCallback is called with the new location.
+ *
+ * @param {Function} successCallback    The function to call each time the location data is available
+ * @param {Function} errorCallback      The function to call when there is an error getting the location data. (OPTIONAL)
+ * @param {PositionOptions} options     The options for getting the location data such as frequency. (OPTIONAL)
+ * @return String                       The watch id that must be passed to #clearWatch to stop watching.
+ */
+Geolocation.prototype.watchPosition = function(successCallback, errorCallback, options) {
+
+    // default maximumAge value should be 0, and set if positive 
+    var maximumAge = 0;
+
+    // DO NOT set timeout to a large value for watchPosition in BlackBerry.  
+    // The interval used for updates is half the timeout value, so a large 
+    // timeout value will mean a long wait for the first location.
+    var timeout = 10000; 
+
+    var enableHighAccuracy = false;
+    if (options) {
+        if (options.maximumAge && (options.maximumAge > 0)) {
+            maximumAge = options.maximumAge;
+        }
+        if (options.enableHighAccuracy) {
+            enableHighAccuracy = options.enableHighAccuracy;
+        }
+        if (options.timeout) {
+            timeout = (options.timeout < 0) ? 0 : options.timeout;
+        }
+    }
+    this.id = Cordova.createUUID();
+    Cordova.exec(successCallback, errorCallback, "com.cordova.Geolocation", "watchPosition", [maximumAge, timeout, enableHighAccuracy]);
+    return this.id;
+};
+
+/**
+ * Clears the specified position watch.
+ *
+ * @param {String} id       The ID of the watch returned from #watchPosition
+ */
+Geolocation.prototype.clearWatch = function(id) {
+    Cordova.exec(null, null, "com.cordova.Geolocation", "stop", []);
+    this.id = null;
+};
+
+/**
+ * Force the Cordova geolocation to be used instead of built-in.
+ */
+Geolocation.usingCordova = false;
+Geolocation.useCordova = function() {
+    if (Geolocation.usingCordova) {
+        return;
+    }
+    Geolocation.usingCordova = true;
+
+    // Set built-in geolocation methods to our own implementations
+    // (Cannot replace entire geolocation, but can replace individual methods)
+    navigator.geolocation.getCurrentPosition = navigator._geo.getCurrentPosition;
+    navigator.geolocation.watchPosition = navigator._geo.watchPosition;
+    navigator.geolocation.clearWatch = navigator._geo.clearWatch;
+    navigator.geolocation.success = navigator._geo.success;
+    navigator.geolocation.fail = navigator._geo.fail;
+};
+
+Cordova.addConstructor(function() {
+    navigator._geo = new Geolocation();
+
+    // if no native geolocation object, use Cordova geolocation
+    if (typeof navigator.geolocation == 'undefined') {
+        navigator.geolocation = navigator._geo;
+        Geolocation.usingCordova = true;
+    }
+});

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/d3ab5427/Res/cordova/network.js
----------------------------------------------------------------------
diff --git a/Res/cordova/network.js b/Res/cordova/network.js
new file mode 100644
index 0000000..cbe3d68
--- /dev/null
+++ b/Res/cordova/network.js
@@ -0,0 +1,58 @@
+
+/*
+ * Cordova is available under *either* the terms of the modified BSD license *or* the
+ * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
+ * 
+ * Copyright (c) 2005-2010, Nitobi Software Inc.
+ * Copyright (c) 2010, IBM Corporation
+ */
+
+/**
+ * Network status.
+ */
+NetworkStatus = {
+  NOT_REACHABLE: 0,
+  REACHABLE_VIA_CARRIER_DATA_NETWORK: 1,
+  REACHABLE_VIA_WIFI_NETWORK: 2
+};
+
+/**
+ * This class provides access to device Network data (reachability).
+ * @constructor
+ */
+function Network() {
+    /**
+     * The last known Network status.
+	 * { hostName: string, ipAddress: string, 
+		remoteHostStatus: int(0/1/2), internetConnectionStatus: int(0/1/2), localWiFiConnectionStatus: int (0/2) }
+     */
+	this.lastReachability = null;
+};
+
+/**
+ * Determine if a URI is reachable over the network.
+
+ * @param {Object} uri
+ * @param {Function} callback
+ * @param {Object} options  (isIpAddress:boolean)
+ */
+Network.prototype.isReachable = function(uri, callback, options) {
+    var isIpAddress = false;
+    if (options && options.isIpAddress) {
+        isIpAddress = options.isIpAddress;
+    }
+    Cordova.exec(callback, null, 'com.cordova.Network', 'isReachable', [uri, isIpAddress]);
+};
+
+/**
+ * Called by the geolocation framework when the reachability status has changed.
+ * @param {Reachibility} reachability The current reachability status.
+ */
+// TODO: Callback from native code not implemented for Android
+Network.prototype.updateReachability = function(reachability) {
+    this.lastReachability = reachability;
+};
+
+Cordova.addConstructor(function() {
+	if (typeof navigator.network == "undefined") navigator.network = new Network();
+});