Permalink
Browse files

merging from upstream master

  • Loading branch information...
2 parents c27a22c + fe675fe commit 09d8ad2f79b37b4f88c84e074b6fe4eddf3d77d1 Andy Wu committed Oct 27, 2012
Showing with 12,533 additions and 8 deletions.
  1. +6 −0 .gitignore
  2. +81 −0 BB10/COMPASS/README.md
  3. +3 −0 BB10/COMPASS/TestApplication/README.md
  4. +30 −0 BB10/COMPASS/TestApplication/config.xml
  5. +42 −0 BB10/COMPASS/TestApplication/index.htm
  6. +38 −0 BB10/COMPASS/javascript_src/client.js
  7. +121 −0 BB10/COMPASS/javascript_src/index.js
  8. +5 −0 BB10/COMPASS/javascript_src/manifest.json
  9. +320 −0 BB10/COMPASS/native_src/public/plugin.cpp
  10. +70 −0 BB10/COMPASS/native_src/public/plugin.h
  11. +222 −0 BB10/COMPASS/native_src/public/tokenizer.cpp
  12. +55 −0 BB10/COMPASS/native_src/public/tokenizer.h
  13. +301 −0 BB10/COMPASS/native_src/src/compass_js.cpp
  14. +53 −0 BB10/COMPASS/native_src/src/compass_js.hpp
  15. +38 −0 BB10/COMPASS/output/community.compass/client.js
  16. BIN BB10/COMPASS/output/community.compass/device/compassJnext.so
  17. +121 −0 BB10/COMPASS/output/community.compass/index.js
  18. +5 −0 BB10/COMPASS/output/community.compass/manifest.json
  19. BIN BB10/COMPASS/output/community.compass/simulator/compassJnext.so
  20. +525 −0 BB10/COMPASS/project/compassJnext/.cproject
  21. +89 −0 BB10/COMPASS/project/compassJnext/.project
  22. +320 −0 BB10/COMPASS/project/compassJnext/public/plugin.cpp
  23. +70 −0 BB10/COMPASS/project/compassJnext/public/plugin.h
  24. +222 −0 BB10/COMPASS/project/compassJnext/public/tokenizer.cpp
  25. +55 −0 BB10/COMPASS/project/compassJnext/public/tokenizer.h
  26. +301 −0 BB10/COMPASS/project/compassJnext/src/compass_js.cpp
  27. +53 −0 BB10/COMPASS/project/compassJnext/src/compass_js.hpp
  28. +52 −0 BB10/LED/README.md
  29. +13 −0 BB10/LED/TestApplication/config.xml
  30. +65 −0 BB10/LED/TestApplication/index.html
  31. +28 −0 BB10/LED/javascript_src/client.js
  32. +94 −0 BB10/LED/javascript_src/index.js
  33. +5 −0 BB10/LED/javascript_src/manifest.json
  34. BIN BB10/LED/output/community.led/ledJnext.so
  35. +7 −0 BB10/README.md
  36. +40 −0 BB10/screen/README.md
  37. +49 −0 BB10/screen/TestApp/config.xml
  38. +70 −0 BB10/screen/TestApp/index.html
  39. +4 −0 BB10/screen/TestApp/jquery/jquery-1.7.1.min.js
  40. +2 −0 BB10/screen/TestApp/jquery/jquery.mobile-1.1.0.min.css
  41. +177 −0 BB10/screen/TestApp/jquery/jquery.mobile-1.1.0.min.js
  42. +25 −0 BB10/screen/extension/client.js
  43. +75 −0 BB10/screen/extension/index.js
  44. +5 −0 BB10/screen/extension/manifest.json
  45. +773 −0 BB10/screen/licenses.txt
  46. +556 −0 BB10/screen/ndk-project/.cproject
  47. +77 −0 BB10/screen/ndk-project/.project
  48. +19 −0 BB10/screen/ndk-project/public/json/autolink.h
  49. +43 −0 BB10/screen/ndk-project/public/json/config.h
  50. +42 −0 BB10/screen/ndk-project/public/json/features.h
  51. +39 −0 BB10/screen/ndk-project/public/json/forwards.h
  52. +10 −0 BB10/screen/ndk-project/public/json/json.h
  53. +196 −0 BB10/screen/ndk-project/public/json/reader.h
  54. +1,069 −0 BB10/screen/ndk-project/public/json/value.h
  55. +174 −0 BB10/screen/ndk-project/public/json/writer.h
  56. +125 −0 BB10/screen/ndk-project/public/json_batchallocator.h
  57. +448 −0 BB10/screen/ndk-project/public/json_internalarray.inl
  58. +607 −0 BB10/screen/ndk-project/public/json_internalmap.inl
  59. +892 −0 BB10/screen/ndk-project/public/json_reader.cpp
  60. +1,726 −0 BB10/screen/ndk-project/public/json_value.cpp
  61. +292 −0 BB10/screen/ndk-project/public/json_valueiterator.inl
  62. +829 −0 BB10/screen/ndk-project/public/json_writer.cpp
  63. +320 −0 BB10/screen/ndk-project/public/plugin.cpp
  64. +70 −0 BB10/screen/ndk-project/public/plugin.h
  65. +222 −0 BB10/screen/ndk-project/public/tokenizer.cpp
  66. +55 −0 BB10/screen/ndk-project/public/tokenizer.h
  67. +83 −0 BB10/screen/ndk-project/src/qtest.cpp
  68. +4 −3 README.md
  69. +5 −5 Tablet/UploadDownload/README.md
View
@@ -0,0 +1,6 @@
+add
+.DS_Store
+.metadata/
+.settings/
+*.[o]
+webworks-1.0.2.9.js
@@ -0,0 +1,81 @@
+# Compass API
+
+The Compass API allows you to read the leading of the compass in your device.
+
+**Tested On**
+
+* BlackBerry 10.0.9.388
+
+**Author(s)**
+
+* [Arman Fallah](https://github.com/starpax)
+
+**To contribute code to this repository you must be [signed up as an official contributor](http://blackberry.github.com/howToContribute.html).**
+
+## How To Install The Extension
+
+1. Clone the repo to your local machine
+2. Locate your BlackBerry WebWorks SDK **C:\Program Files\Research In Motion\BlackBerry 10 WebWorks SDK <version>\Framework\ext** (Windows) or **~/SDKs/BlackBerry 10 WebWorks SDK <version>/Framework/ext** (Mac)
+3. Create a new directory **community.compass** in the **ext** directory
+4. Copy **output/community.compass/compassJnext.so** to **/path/to/sdk/ext/community.compass/device/compassJnext.so**
+5. Copy everything in **javascript_src** to **/path/to/sdk/ext/community.compass/**
+
+## Required Feature ID
+Whenever you use the below feature id in any of your WebWorks applications this extension will be loaded for use.
+
+ <feature id="community.compass" required="true" version="1.0.0.0" />
+
+## Summary
+
+**community.compass.readCompass()**
+
+Return:
+number - degrees from Magnetic North
+
+Example:
+
+ <script type="text/javascript">
+ var leading = community.compass.readCompass();
+ </script>
+
+**community.compass.startMonitoringCompass([Function:fun])**
+
+Parameter:
+fun: a one parameter method to call each second, that parameter stores the compass leading
+
+Return:
+[String] - status message of monitoring the compass
+
+Example:
+
+ <script type="text/javascript">
+ function compassCallback(compassLeading)
+ {
+ document.getElementById("leading").innerHTML = "Degrees from Magnetic North: " + compassLeading;
+ }
+
+ function startMonitoringCompass()
+ {
+ var ret = community.compass.startMonitoringCompass(compassCallback);
+ alert(ret);
+ }
+ </script>
+
+**community.compass.stopMonitoringCompass()**
+
+Return:
+[String] - status message of stopping the monitoring the compass
+
+Example:
+
+ <script type="text/javascript">
+ function stopMonitoringCompass()
+ {
+ var ret = community.compass.stopMonitoringCompass();
+ alert(ret);
+ }
+ </script>
+
+## Disclaimer
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
+# Where to find the missing file webworks-1.0.0.7.js
+
+You will find it under Framework/clientFiles/webworks-1.0.0.7.js in your WebWorks SDK installation folder and copy it to this folder.
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2012 Research In Motion Limited.
+
+ 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.
+-->
+<widget xmlns="http://www.w3.org/ns/widgets"
+ xmlns:rim="http://www.blackberry.com/ns/widgets"
+ version="1.0.0"
+ id="CompassExtension">
+ <name>Compass Test</name>
+ <content src="index.htm"/>
+ <author>
+ Research In Motion Ltd.
+ </author>
+ <description>This application shows how to use the compass extension.</description>
+ <feature id="community.compass" required="true" version="1.0.0.0"/>
+ <access uri="*"/>
+ <license href="http://www.apache.org/licenses/LICENSE-2.0">My License</license>
+</widget>
@@ -0,0 +1,42 @@
+<html>
+ <head>
+ <title>Community - Compass Extension</title>
+ <script type="text/javascript" src="webworks-1.0.2.9.js"></script>
+ <script type="text/javascript">
+ function compassCallback(compassLeading) {
+ document.getElementById("leading").innerHTML = "Degrees from Magnetic North: " + compassLeading;
+ }
+
+ function startMonitoringCompass() {
+ var ret = community.compass.startMonitoringCompass(compassCallback);
+ alert(ret);
+ }
+
+ function getCompassLeading() {
+ var ret = community.compass.readCompass();
+ alert(ret);
+ }
+
+ function stopMonitoringCompass() {
+ var ret = community.compass.stopMonitoringCompass();
+ alert(ret);
+ }
+ </script>
+ </head>
+ <body bgcolor="#FF9900">
+ <div align="center">
+ <button style="width:280px; height: 240px; font-size: 200%; background-color: lightgreen" onClick="startMonitoringCompass()">
+ Start Monitoring Compass
+ </button>
+ <button style="width:280px; height: 240px; font-size: 200%; background-color: lightgreen" onClick="stopMonitoringCompass()">
+ Stop Monitoring Compass
+ </button>
+ <button style="width:280px; height: 240px; font-size: 200%; background-color: lightgreen" onClick="getCompassLeading()">
+ Get Compass Leading
+ </button>
+ <br />
+ </div>
+ <div id="leading" style="font-size: 200%; background-color: lightblue">
+ </div>
+ </body>
+</html>
@@ -0,0 +1,38 @@
+/*
+* Copyright 2012 Research In Motion Limited.
+*
+* 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.
+*/
+
+var _self = {},
+ _ID = require("./manifest.json").namespace;
+
+_self.readCompass = function (cb)
+{
+ return window.webworks.execSync(_ID, "readCompassServer", null);
+};
+
+_self.stopMonitoringCompass = function (cb)
+{
+ return window.webworks.execSync(_ID, "stopMonitoringCompassServer", null);
+};
+
+
+_self.startMonitoringCompass = function (cb)
+{
+ window.webworks.event.add(_ID, "community.compass.compassEvent", cb);
+
+ return window.webworks.execSync(_ID, "startMonitoringCompassServer", null);
+};
+
+module.exports = _self;
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2012 Research In Motion Limited.
+ *
+ * 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.
+ */
+var compassJNext,
+ _event = require("../../lib/event");
+
+module.exports =
+{
+ startMonitoringCompassServer: function (success, fail, args, env)
+ {
+ try
+ {
+ success(compassJNext.startMonitoringCompassJNext());
+ }
+ catch (e)
+ {
+ fail(-1, e);
+ }
+ },
+
+ stopMonitoringCompassServer: function (success, fail, args, env)
+ {
+ try
+ {
+ success(compassJNext.stopMonitoringCompassJNext());
+ }
+ catch (e)
+ {
+ fail(-1, e);
+ }
+ },
+
+ readCompassServer: function (success, fail, args, env)
+ {
+ try
+ {
+ success(compassJNext.readCompassJNext());
+ }
+ catch (e)
+ {
+ fail(-1, e);
+ }
+ },
+};
+
+///////////////////////////////////////////////////////////////////
+// JavaScript wrapper for JNEXT plugin
+///////////////////////////////////////////////////////////////////
+
+JNEXT.CompassJNext = function ()
+{
+ var _self = this;
+
+ _self.startMonitoringCompassJNext = function ()
+ {
+ return JNEXT.invoke(_self._id, "startMonitoringNative");
+ };
+
+ _self.stopMonitoringCompassJNext = function ()
+ {
+ return JNEXT.invoke(_self._id, "stopMonitoringNative");
+ };
+
+ _self.readCompassJNext = function ()
+ {
+ return JNEXT.invoke(_self._id, "readCompassNative");
+ };
+
+ _self.getId = function ()
+ {
+ return _self._id;
+ };
+
+ _self.init = function ()
+ {
+ if (!JNEXT.require("compassJnext"))
+ {
+ return false;
+ }
+
+ _self._id = JNEXT.createObject("compassJnext.Compass");
+
+ if (!_self._id || _self._id === "")
+ {
+ return false;
+ }
+
+ JNEXT.registerEvents(_self);
+ };
+
+ _self.onEvent = function (strData)
+ {
+ var arData = strData.split(" "),
+ strEventId = arData[0],
+ arg = arData[1];
+
+ // Trigger the event handler of specific Push events
+ if (strEventId === "CompassLeading")
+ {
+ _event.trigger("community.compass.compassEvent", arg);
+ }
+ };
+
+ _self._id = "";
+
+ _self.init();
+};
+
+compassJNext = new JNEXT.CompassJNext();
@@ -0,0 +1,5 @@
+{
+ "global": false,
+ "namespace": "community.compass",
+ "dependencies": []
+}
Oops, something went wrong. Retry.

0 comments on commit 09d8ad2

Please sign in to comment.