You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2014/04/25 20:12:57 UTC
[1/2] Git Push Summary
Repository: cordova-plugin-device-orientation
Updated Branches:
refs/heads/dev f434201bf -> 0061de921
[2/2] git commit: CB-6521: Remove development branch
Posted by ia...@apache.org.
CB-6521: Remove development branch
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/commit/0061de92
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/tree/0061de92
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/diff/0061de92
Branch: refs/heads/dev
Commit: 0061de921352d77c20bdde82ba6f68522ce21180
Parents: f434201
Author: Ian Clelland <ic...@chromium.org>
Authored: Fri Apr 25 14:09:46 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Fri Apr 25 14:09:46 2014 -0400
----------------------------------------------------------------------
LICENSE | 202 -------------------
NOTICE | 5 -
README.md | 2 +
RELEASENOTES.md | 58 ------
doc/index.md | 195 ------------------
plugin.xml | 166 ----------------
src/android/CompassListener.java | 296 ---------------------------
src/blackberry10/index.js | 33 ----
src/firefoxos/compass.js | 43 ----
src/ios/CDVCompass.h | 68 -------
src/ios/CDVCompass.m | 306 ----------------------------
src/tizen/CompassProxy.js | 57 ------
src/ubuntu/compass.cpp | 75 -------
src/ubuntu/compass.h | 58 ------
src/windows8/CompassProxy.js | 67 -------
src/wp/Compass.cs | 362 ----------------------------------
www/CompassError.js | 34 ----
www/CompassHeading.js | 29 ---
www/compass.js | 103 ----------
19 files changed, 2 insertions(+), 2157 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 7a4a3ea..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- 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/cordova-plugin-device-orientation/blob/0061de92/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
deleted file mode 100644
index 8ec56a5..0000000
--- a/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Cordova
-Copyright 2012 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index a1b57b6..ed3d855 100644
--- a/README.md
+++ b/README.md
@@ -20,3 +20,5 @@
# org.apache.cordova.device-orientation
Plugin documentation: [doc/index.md](doc/index.md)
+
+This is `dev` - the deprecated development branch of this plugin; development of this plugin has moved to the `master` branch
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
deleted file mode 100644
index 77b29bd..0000000
--- a/RELEASENOTES.md
+++ /dev/null
@@ -1,58 +0,0 @@
-<!--
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
--->
-# Release Notes
-
-
-### 0.3.0 (Sept 5, 2013)
-* [CB-3687] Added blackberry10 support
-
-### 0.3.1 (Sept 25, 2013)
-* CB-4889 renaming id
-* CB-4889 renaming core in CompassProxy
-* [CB-4900] Windows 8 Compass plugin have extra define breaks plugin loading
-* [windows8] commandProxy was moved
-* Rename CHANGELOG.md -> RELEASENOTES.md
-* [CB-4752] Incremented plugin version on dev branch.
-
-### 0.3.2 (Oct 28, 2013)
-* orientation plugin
-* CB-5128: added repo + issue tag to plugin.xml for device orientation plugin
-* [CB-4915] Incremented plugin version on dev branch.
-
-### 0.3.3 (Dec 4, 2013)
-* add ubuntu platform
-* 1. Added amazon-fireos platform. 2. Change to use amazon-fireos as a platform if user agent string contains 'cordova-amazon-fireos'.
-
-### 0.3.4 (Jan 02, 2014)
-* CB-5658 Add doc/index.md for Compass plugin
-
-### 0.3.5 (Feb 05, 2014)
-* [ubuntu] request sensors permission
-* [ubuntu] add missing files
-* Add support for Tizen.
-* FFOS info added
-
-### 0.3.6 (Apr 17, 2014)
-* CB-6381: [WP8] unexpected error object
-* CB-6422: [windows8] use cordova/exec/proxy
-* CB-6460: Update license headers
-* CB-6465: Add license headers to Tizen code
-* Add NOTICE file
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
deleted file mode 100644
index 37d2f28..0000000
--- a/doc/index.md
+++ /dev/null
@@ -1,195 +0,0 @@
-<!---
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-# org.apache.cordova.device-orientation
-
-This plugin provides access to the device's compass. The compass is a sensor
-that detects the direction or heading that the device is pointed, typically
-from the top of the device. It measures the heading in degrees from 0 to
-359.99, where 0 is north.
-
-## Installation
-
- cordova plugin add org.apache.cordova.device-orientation
-
-## Supported Platforms
-
-- Amazon Fire OS
-- Android
-- BlackBerry 10
-- Firefox OS
-- iOS
-- Tizen
-- Windows Phone 7 and 8 (if available in hardware)
-- Windows 8
-
-## Methods
-
-- navigator.compass.getCurrentHeading
-- navigator.compass.watchHeading
-- navigator.compass.clearWatch
-
-## navigator.compass.getCurrentHeading
-
-Get the current compass heading. The compass heading is returned via a `CompassHeading`
-object using the `compassSuccess` callback function.
-
- navigator.compass.getCurrentHeading(compassSuccess, compassError);
-
-### Example
-
- function onSuccess(heading) {
- alert('Heading: ' + heading.magneticHeading);
- };
-
- function onError(error) {
- alert('CompassError: ' + error.code);
- };
-
- navigator.compass.getCurrentHeading(onSuccess, onError);
-
-## navigator.compass.watchHeading
-
-Gets the device's current heading at a regular interval. Each time the heading
-is retrieved, the `headingSuccess` callback function is executed.
-
-The returned watch ID references the compass watch interval. The watch
-ID can be used with `navigator.compass.clearWatch` to stop watching the navigator.compass.
-
- var watchID = navigator.compass.watchHeading(compassSuccess, compassError, [compassOptions]);
-
-`compassOptions` may contain the following keys:
-
-- __frequency__: How often to retrieve the compass heading in milliseconds. _(Number)_ (Default: 100)
-- __filter__: The change in degrees required to initiate a watchHeading success callback. When this value is set, __frequency__ is ignored. _(Number)_
-
-### Example
-
- function onSuccess(heading) {
- var element = document.getElementById('heading');
- element.innerHTML = 'Heading: ' + heading.magneticHeading;
- };
-
- function onError(compassError) {
- alert('Compass error: ' + compassError.code);
- };
-
- var options = {
- frequency: 3000
- }; // Update every 3 seconds
-
- var watchID = navigator.compass.watchHeading(onSuccess, onError, options);
-
-
-### iOS Quirks
-
-Only one `watchHeading` can be in effect at one time in iOS. If a
-`watchHeading` uses a filter, calling `getCurrentHeading` or
-`watchHeading` uses the existing filter value to specify heading
-changes. Watching heading changes with a filter is more efficient than
-with time intervals.
-
-### Amazon Fire OS Quirks
-
-- `filter` is not supported.
-
-### Android Quirks
-
-- No support for `filter`.
-
-### Firefox OS Quirks
-
-- No support for `filter`.
-
-### Tizen Quirks
-
-- No support for `filter`.
-
-### Windows Phone 7 and 8 Quirks
-
-- No support for `filter`.
-
-## navigator.compass.clearWatch
-
-Stop watching the compass referenced by the watch ID parameter.
-
- navigator.compass.clearWatch(watchID);
-
-- __watchID__: The ID returned by `navigator.compass.watchHeading`.
-
-### Example
-
- var watchID = navigator.compass.watchHeading(onSuccess, onError, options);
-
- // ... later on ...
-
- navigator.compass.clearWatch(watchID);
-
-## CompassHeading
-
-A `CompassHeading` object is returned to the `compassSuccess` callback function.
-
-### Properties
-
-- __magneticHeading__: The heading in degrees from 0-359.99 at a single moment in time. _(Number)_
-
-- __trueHeading__: The heading relative to the geographic North Pole in degrees 0-359.99 at a single moment in time. A negative value indicates that the true heading can't be determined. _(Number)_
-
-- __headingAccuracy__: The deviation in degrees between the reported heading and the true heading. _(Number)_
-
-- __timestamp__: The time at which this heading was determined. _(milliseconds)_
-
-
-### Amazon Fire OS Quirks
-
-- `trueHeading` is not supported, but reports the same value as `magneticHeading`
-
-- `headingAccuracy` is always 0 because there is no difference between the `magneticHeading` and `trueHeading`
-
-### Android Quirks
-
-- The `trueHeading` property is not supported, but reports the same value as `magneticHeading`.
-
-- The `headingAccuracy` property is always 0 because there is no difference between the `magneticHeading` and `trueHeading`.
-
-### Firefox OS Quirks
-
-- The `trueHeading` property is not supported, but reports the same value as `magneticHeading`.
-
-- The `headingAccuracy` property is always 0 because there is no difference between the `magneticHeading` and `trueHeading`.
-
-### iOS Quirks
-
-- The `trueHeading` property is only returned for location services enabled via `navigator.geolocation.watchLocation()`.
-
-- For iOS 4 devices and above, heading factors in the device's current orientation, and does not reference its absolute position, for apps that supports that orientation.
-
-## CompassError
-
-A `CompassError` object is returned to the `compassError` callback function when an error occurs.
-
-### Properties
-
-- __code__: One of the predefined error codes listed below.
-
-### Constants
-
-- `CompassError.COMPASS_INTERNAL_ERR`
-- `CompassError.COMPASS_NOT_SUPPORTED`
-
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
deleted file mode 100644
index 69b9897..0000000
--- a/plugin.xml
+++ /dev/null
@@ -1,166 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
- xmlns:android="http://schemas.android.com/apk/res/android"
- id="org.apache.cordova.device-orientation"
- version="0.3.7-dev">
-
- <name>Device Orientation</name>
- <description>Cordova Device Orientation Plugin</description>
- <license>Apache 2.0</license>
- <keywords>cordova,device,orientation</keywords>
- <repo>https://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation.git</repo>
- <issue>https://issues.apache.org/jira/browse/CB/component/12320637</issue>
-
- <js-module src="www/CompassError.js" name="CompassError">
- <clobbers target="CompassError" />
- </js-module>
-
- <js-module src="www/CompassHeading.js" name="CompassHeading">
- <clobbers target="CompassHeading" />
- </js-module>
-
- <js-module src="www/compass.js" name="compass">
- <clobbers target="navigator.compass" />
- </js-module>
-
- <!-- firefoxos -->
- <platform name="firefoxos">
- <config-file target="config.xml" parent="/*">
- <feature name="Compass">
- <param name="firefoxos-package" value="Compass" />
- </feature>
- </config-file>
-
- <js-module src="src/firefoxos/compass.js" name="compass-impl">
- <runs />
- </js-module>
- </platform>
-
- <!-- android -->
- <platform name="android">
- <config-file target="res/xml/config.xml" parent="/*">
- <feature name="Compass">
- <param name="android-package" value="org.apache.cordova.deviceorientation.CompassListener"/>
- </feature>
- </config-file>
-
- <config-file target="AndroidManifest.xml" parent="/*">
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
- </config-file>
-
- <source-file src="src/android/CompassListener.java" target-dir="src/org/apache/cordova/deviceorientation" />
- </platform>
-
- <!-- amazon-fireos -->
- <platform name="amazon-fireos">
- <config-file target="res/xml/config.xml" parent="/*">
- <feature name="Compass">
- <param name="android-package" value="org.apache.cordova.deviceorientation.CompassListener"/>
- </feature>
- </config-file>
-
- <config-file target="AndroidManifest.xml" parent="/*">
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
- </config-file>
-
- <source-file src="src/android/CompassListener.java" target-dir="src/org/apache/cordova/deviceorientation" />
- </platform>
-
- <!-- ubuntu -->
- <platform name="ubuntu">
- <header-file src="src/ubuntu/compass.h" />
- <source-file src="src/ubuntu/compass.cpp" />
- <config-file target="config.xml" parent="/*">
- <feature name="DeviceOrientation">
- <param policy_group="sensors" policy_version="1" />
- </feature>
- </config-file>
- </platform>
-
- <!-- blackberry10 -->
- <platform name="blackberry10">
- <config-file target="www/config.xml" parent="/widget">
- <feature name="Compass" value="Compass" />
- </config-file>
- <source-file src="src/blackberry10/index.js" target-dir="Compass" />
- </platform>
-
- <!-- ios -->
- <platform name="ios">
-
- <config-file target="config.xml" parent="/*">
- <feature name="Compass">
- <param name="ios-package" value="CDVCompass"/>
- </feature>
- </config-file>
-
- <header-file src="src/ios/CDVCompass.h" />
- <source-file src="src/ios/CDVCompass.m" />
-
- </platform>
-
- <!-- wp7 -->
- <platform name="wp7">
- <config-file target="config.xml" parent="/*">
- <feature name="Compass">
- <param name="wp-package" value="Compass"/>
- </feature>
- </config-file>
-
- <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
- <Capability Name="ID_CAP_SENSORS" />
- </config-file>
-
- <source-file src="src/wp/Compass.cs" />
- </platform>
-
- <!-- wp8 -->
- <platform name="wp8">
- <config-file target="config.xml" parent="/*">
- <feature name="Compass">
- <param name="wp-package" value="Compass"/>
- </feature>
- </config-file>
-
- <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
- <Capability Name="ID_CAP_SENSORS" />
- </config-file>
-
- <source-file src="src/wp/Compass.cs" />
- </platform>
-
- <!-- windows8 -->
- <platform name="windows8">
- <js-module src="src/windows8/CompassProxy.js" name="CompassProxy">
- <merges target="" />
- </js-module>
- </platform>
-
- <!-- tizen -->
- <platform name="tizen">
- <js-module src="src/tizen/CompassProxy.js" name="CompassProxy">
- <runs/>
- </js-module>
- </platform>
-</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/src/android/CompassListener.java
----------------------------------------------------------------------
diff --git a/src/android/CompassListener.java b/src/android/CompassListener.java
deleted file mode 100755
index 194db0d..0000000
--- a/src/android/CompassListener.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-*/
-package org.apache.cordova.deviceorientation;
-
-import java.util.List;
-
-import org.apache.cordova.CordovaWebView;
-import org.apache.cordova.CallbackContext;
-import org.apache.cordova.CordovaInterface;
-import org.apache.cordova.CordovaPlugin;
-import org.apache.cordova.PluginResult;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.hardware.Sensor;
-import android.hardware.SensorEvent;
-import android.hardware.SensorEventListener;
-import android.hardware.SensorManager;
-import android.content.Context;
-
-import android.os.Handler;
-import android.os.Looper;
-
-/**
- * This class listens to the compass sensor and stores the latest heading value.
- */
-public class CompassListener extends CordovaPlugin implements SensorEventListener {
-
- public static int STOPPED = 0;
- public static int STARTING = 1;
- public static int RUNNING = 2;
- public static int ERROR_FAILED_TO_START = 3;
-
- public long TIMEOUT = 30000; // Timeout in msec to shut off listener
-
- int status; // status of listener
- float heading; // most recent heading value
- long timeStamp; // time of most recent value
- long lastAccessTime; // time the value was last retrieved
- int accuracy; // accuracy of the sensor
-
- private SensorManager sensorManager;// Sensor manager
- Sensor mSensor; // Compass sensor returned by sensor manager
-
- private CallbackContext callbackContext;
-
- /**
- * Constructor.
- */
- public CompassListener() {
- this.heading = 0;
- this.timeStamp = 0;
- this.setStatus(CompassListener.STOPPED);
- }
-
- /**
- * Sets the context of the Command. This can then be used to do things like
- * get file paths associated with the Activity.
- *
- * @param cordova The context of the main Activity.
- * @param webView The CordovaWebView Cordova is running in.
- */
- public void initialize(CordovaInterface cordova, CordovaWebView webView) {
- super.initialize(cordova, webView);
- this.sensorManager = (SensorManager) cordova.getActivity().getSystemService(Context.SENSOR_SERVICE);
- }
-
- /**
- * Executes the request and returns PluginResult.
- *
- * @param action The action to execute.
- * @param args JSONArry of arguments for the plugin.
- * @param callbackS=Context The callback id used when calling back into JavaScript.
- * @return True if the action was valid.
- * @throws JSONException
- */
- public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
- if (action.equals("start")) {
- this.start();
- }
- else if (action.equals("stop")) {
- this.stop();
- }
- else if (action.equals("getStatus")) {
- int i = this.getStatus();
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, i));
- }
- else if (action.equals("getHeading")) {
- // If not running, then this is an async call, so don't worry about waiting
- if (this.status != CompassListener.RUNNING) {
- int r = this.start();
- if (r == CompassListener.ERROR_FAILED_TO_START) {
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.IO_EXCEPTION, CompassListener.ERROR_FAILED_TO_START));
- return true;
- }
- // Set a timeout callback on the main thread.
- Handler handler = new Handler(Looper.getMainLooper());
- handler.postDelayed(new Runnable() {
- public void run() {
- CompassListener.this.timeout();
- }
- }, 2000);
- }
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, getCompassHeading()));
- }
- else if (action.equals("setTimeout")) {
- this.setTimeout(args.getLong(0));
- }
- else if (action.equals("getTimeout")) {
- long l = this.getTimeout();
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, l));
- } else {
- // Unsupported action
- return false;
- }
- return true;
- }
-
- /**
- * Called when listener is to be shut down and object is being destroyed.
- */
- public void onDestroy() {
- this.stop();
- }
-
- /**
- * Called when app has navigated and JS listeners have been destroyed.
- */
- public void onReset() {
- this.stop();
- }
-
- //--------------------------------------------------------------------------
- // LOCAL METHODS
- //--------------------------------------------------------------------------
-
- /**
- * Start listening for compass sensor.
- *
- * @return status of listener
- */
- public int start() {
-
- // If already starting or running, then just return
- if ((this.status == CompassListener.RUNNING) || (this.status == CompassListener.STARTING)) {
- return this.status;
- }
-
- // Get compass sensor from sensor manager
- @SuppressWarnings("deprecation")
- List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_ORIENTATION);
-
- // If found, then register as listener
- if (list != null && list.size() > 0) {
- this.mSensor = list.get(0);
- this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL);
- this.lastAccessTime = System.currentTimeMillis();
- this.setStatus(CompassListener.STARTING);
- }
-
- // If error, then set status to error
- else {
- this.setStatus(CompassListener.ERROR_FAILED_TO_START);
- }
-
- return this.status;
- }
-
- /**
- * Stop listening to compass sensor.
- */
- public void stop() {
- if (this.status != CompassListener.STOPPED) {
- this.sensorManager.unregisterListener(this);
- }
- this.setStatus(CompassListener.STOPPED);
- }
-
- public void onAccuracyChanged(Sensor sensor, int accuracy) {
- // TODO Auto-generated method stub
- }
-
- /**
- * Called after a delay to time out if the listener has not attached fast enough.
- */
- private void timeout() {
- if (this.status == CompassListener.STARTING) {
- this.setStatus(CompassListener.ERROR_FAILED_TO_START);
- if (this.callbackContext != null) {
- this.callbackContext.error("Compass listener failed to start.");
- }
- }
- }
-
- /**
- * Sensor listener event.
- *
- * @param SensorEvent event
- */
- public void onSensorChanged(SensorEvent event) {
-
- // We only care about the orientation as far as it refers to Magnetic North
- float heading = event.values[0];
-
- // Save heading
- this.timeStamp = System.currentTimeMillis();
- this.heading = heading;
- this.setStatus(CompassListener.RUNNING);
-
- // If heading hasn't been read for TIMEOUT time, then turn off compass sensor to save power
- if ((this.timeStamp - this.lastAccessTime) > this.TIMEOUT) {
- this.stop();
- }
- }
-
- /**
- * Get status of compass sensor.
- *
- * @return status
- */
- public int getStatus() {
- return this.status;
- }
-
- /**
- * Get the most recent compass heading.
- *
- * @return heading
- */
- public float getHeading() {
- this.lastAccessTime = System.currentTimeMillis();
- return this.heading;
- }
-
- /**
- * Set the timeout to turn off compass sensor if getHeading() hasn't been called.
- *
- * @param timeout Timeout in msec.
- */
- public void setTimeout(long timeout) {
- this.TIMEOUT = timeout;
- }
-
- /**
- * Get the timeout to turn off compass sensor if getHeading() hasn't been called.
- *
- * @return timeout in msec
- */
- public long getTimeout() {
- return this.TIMEOUT;
- }
-
- /**
- * Set the status and send it to JavaScript.
- * @param status
- */
- private void setStatus(int status) {
- this.status = status;
- }
-
- /**
- * Create the CompassHeading JSON object to be returned to JavaScript
- *
- * @return a compass heading
- */
- private JSONObject getCompassHeading() throws JSONException {
- JSONObject obj = new JSONObject();
-
- obj.put("magneticHeading", this.getHeading());
- obj.put("trueHeading", this.getHeading());
- // Since the magnetic and true heading are always the same our and accuracy
- // is defined as the difference between true and magnetic always return zero
- obj.put("headingAccuracy", 0);
- obj.put("timestamp", this.timeStamp);
-
- return obj;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/src/blackberry10/index.js
----------------------------------------------------------------------
diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js
deleted file mode 100644
index e3f0f94..0000000
--- a/src/blackberry10/index.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2013 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.
- */
-
-module.exports = {
- getHeading: function (success, fail, args, env) {
- var result = new PluginResult(args, env),
- callback = function (orientation) {
- var info = {
- magneticHeading: orientation.alpha,
- trueHeading: 360-orientation.alpha,
- headingAccuracy: 360-(2*orientation.alpha),
- timestamp: new Date().getTime
- };
- window.removeEventListener("deviceorientation", callback);
- result.callbackOk(info, false);
- };
- window.addEventListener("deviceorientation", callback);
- result.noResult(true);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/src/firefoxos/compass.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/compass.js b/src/firefoxos/compass.js
deleted file mode 100644
index 5f6e7ba..0000000
--- a/src/firefoxos/compass.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var Compass = {
- getHeading: function(success, error) {
- var listener = function(ev) {
- var orient = {
- trueHeading: ev.alpha,
- magneticHeading: ev.alpha,
- headingAccuracy: 0,
- timestamp: new Date().getTime()
- }
- success(orient);
- // remove listener after first response
- window.removeEventListener('deviceorientation', listener, false);
- }
- return window.addEventListener('deviceorientation', listener, false);
- },
-};
-
-var firefoxos = require('cordova/platform');
-
-module.exports = Compass;
-require('cordova/firefoxos/commandProxy').add('Compass', Compass);
-
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/src/ios/CDVCompass.h
----------------------------------------------------------------------
diff --git a/src/ios/CDVCompass.h b/src/ios/CDVCompass.h
deleted file mode 100644
index 7377c02..0000000
--- a/src/ios/CDVCompass.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import <UIKit/UIKit.h>
-#import <Cordova/CDVPlugin.h>
-#import <Cordova/CDVShared.h>
-
-enum CDVHeadingStatus {
- HEADINGSTOPPED = 0,
- HEADINGSTARTING,
- HEADINGRUNNING,
- HEADINGERROR
-};
-typedef NSUInteger CDVHeadingStatus;
-
-// simple object to keep track of heading information
-@interface CDVHeadingData : NSObject {}
-
-@property (nonatomic, assign) CDVHeadingStatus headingStatus;
-@property (nonatomic, strong) CLHeading* headingInfo;
-@property (nonatomic, strong) NSMutableArray* headingCallbacks;
-@property (nonatomic, copy) NSString* headingFilter;
-@property (nonatomic, strong) NSDate* headingTimestamp;
-@property (assign) NSInteger timeout;
-
-@end
-
-@interface CDVCompass : CDVPlugin <CLLocationManagerDelegate>{
- @private BOOL __locationStarted;
- @private BOOL __highAccuracyEnabled;
- CDVHeadingData* headingData;
-}
-
-@property (nonatomic, strong) CLLocationManager* locationManager;
-@property (strong) CDVHeadingData* headingData;
-
-- (BOOL)hasHeadingSupport;
-
-- (void)locationManager:(CLLocationManager*)manager
- didFailWithError:(NSError*)error;
-
-- (void)getHeading:(CDVInvokedUrlCommand*)command;
-- (void)returnHeadingInfo:(NSString*)callbackId keepCallback:(BOOL)bRetain;
-- (void)watchHeadingFilter:(CDVInvokedUrlCommand*)command;
-- (void)stopHeading:(CDVInvokedUrlCommand*)command;
-- (void)startHeadingWithFilter:(CLLocationDegrees)filter;
-- (void)locationManager:(CLLocationManager*)manager
- didUpdateHeading:(CLHeading*)heading;
-
-- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager*)manager;
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/src/ios/CDVCompass.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVCompass.m b/src/ios/CDVCompass.m
deleted file mode 100644
index cb3401a..0000000
--- a/src/ios/CDVCompass.m
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import "CDVCompass.h"
-#import <Cordova/NSArray+Comparisons.h>
-
-#pragma mark Constants
-
-#define kPGLocationErrorDomain @"kPGLocationErrorDomain"
-#define kPGLocationDesiredAccuracyKey @"desiredAccuracy"
-#define kPGLocationForcePromptKey @"forcePrompt"
-#define kPGLocationDistanceFilterKey @"distanceFilter"
-#define kPGLocationFrequencyKey @"frequency"
-
-#pragma mark -
-#pragma mark Categories
-
-@interface CLHeading (JSONMethods)
-
-- (NSString*)JSONRepresentation;
-
-@end
-
-
-
-#pragma mark -
-#pragma mark CDVHeadingData
-
-@implementation CDVHeadingData
-
-@synthesize headingStatus, headingInfo, headingCallbacks, headingFilter, headingTimestamp, timeout;
-- (CDVHeadingData*)init
-{
- self = (CDVHeadingData*)[super init];
- if (self) {
- self.headingStatus = HEADINGSTOPPED;
- self.headingInfo = nil;
- self.headingCallbacks = nil;
- self.headingFilter = nil;
- self.headingTimestamp = nil;
- self.timeout = 10;
- }
- return self;
-}
-
-@end
-
-#pragma mark -
-#pragma mark CDVLocation
-
-@implementation CDVCompass
-
-@synthesize locationManager, headingData;
-
-- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView
-{
- self = (CDVCompass*)[super initWithWebView:(UIWebView*)theWebView];
- if (self) {
- self.locationManager = [[CLLocationManager alloc] init];
- self.locationManager.delegate = self; // Tells the location manager to send updates to this object
- __locationStarted = NO;
- __highAccuracyEnabled = NO;
- self.headingData = nil;
- }
- return self;
-}
-
-- (BOOL)hasHeadingSupport
-{
- BOOL headingInstancePropertyAvailable = [self.locationManager respondsToSelector:@selector(headingAvailable)]; // iOS 3.x
- BOOL headingClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(headingAvailable)]; // iOS 4.x
-
- if (headingInstancePropertyAvailable) { // iOS 3.x
- return [(id)self.locationManager headingAvailable];
- } else if (headingClassPropertyAvailable) { // iOS 4.x
- return [CLLocationManager headingAvailable];
- } else { // iOS 2.x
- return NO;
- }
-}
-
-// called to get the current heading
-// Will call location manager to startUpdatingHeading if necessary
-
-- (void)getHeading:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSDictionary* options = [command.arguments objectAtIndex:0 withDefault:nil];
- NSNumber* filter = [options valueForKey:@"filter"];
-
- if (filter) {
- [self watchHeadingFilter:command];
- return;
- }
- if ([self hasHeadingSupport] == NO) {
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:20];
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
- } else {
- // heading retrieval does is not affected by disabling locationServices and authorization of app for location services
- if (!self.headingData) {
- self.headingData = [[CDVHeadingData alloc] init];
- }
- CDVHeadingData* hData = self.headingData;
-
- if (!hData.headingCallbacks) {
- hData.headingCallbacks = [NSMutableArray arrayWithCapacity:1];
- }
- // add the callbackId into the array so we can call back when get data
- [hData.headingCallbacks addObject:callbackId];
-
- if ((hData.headingStatus != HEADINGRUNNING) && (hData.headingStatus != HEADINGERROR)) {
- // Tell the location manager to start notifying us of heading updates
- [self startHeadingWithFilter:0.2];
- } else {
- [self returnHeadingInfo:callbackId keepCallback:NO];
- }
- }
-}
-
-// called to request heading updates when heading changes by a certain amount (filter)
-- (void)watchHeadingFilter:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSDictionary* options = [command.arguments objectAtIndex:0 withDefault:nil];
- NSNumber* filter = [options valueForKey:@"filter"];
- CDVHeadingData* hData = self.headingData;
-
- if ([self hasHeadingSupport] == NO) {
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:20];
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
- } else {
- if (!hData) {
- self.headingData = [[CDVHeadingData alloc] init];
- hData = self.headingData;
- }
- if (hData.headingStatus != HEADINGRUNNING) {
- // Tell the location manager to start notifying us of heading updates
- [self startHeadingWithFilter:[filter doubleValue]];
- } else {
- // if already running check to see if due to existing watch filter
- if (hData.headingFilter && ![hData.headingFilter isEqualToString:callbackId]) {
- // new watch filter being specified
- // send heading data one last time to clear old successCallback
- [self returnHeadingInfo:hData.headingFilter keepCallback:NO];
- }
- }
- // save the new filter callback and update the headingFilter setting
- hData.headingFilter = callbackId;
- // check if need to stop and restart in order to change value???
- self.locationManager.headingFilter = [filter doubleValue];
- }
-}
-
-- (void)returnHeadingInfo:(NSString*)callbackId keepCallback:(BOOL)bRetain
-{
- CDVPluginResult* result = nil;
- CDVHeadingData* hData = self.headingData;
-
- self.headingData.headingTimestamp = [NSDate date];
-
- if (hData && (hData.headingStatus == HEADINGERROR)) {
- // return error
- result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:0];
- } else if (hData && (hData.headingStatus == HEADINGRUNNING) && hData.headingInfo) {
- // if there is heading info, return it
- CLHeading* hInfo = hData.headingInfo;
- NSMutableDictionary* returnInfo = [NSMutableDictionary dictionaryWithCapacity:4];
- NSNumber* timestamp = [NSNumber numberWithDouble:([hInfo.timestamp timeIntervalSince1970] * 1000)];
- [returnInfo setObject:timestamp forKey:@"timestamp"];
- [returnInfo setObject:[NSNumber numberWithDouble:hInfo.magneticHeading] forKey:@"magneticHeading"];
- id trueHeading = __locationStarted ? (id)[NSNumber numberWithDouble : hInfo.trueHeading] : (id)[NSNull null];
- [returnInfo setObject:trueHeading forKey:@"trueHeading"];
- [returnInfo setObject:[NSNumber numberWithDouble:hInfo.headingAccuracy] forKey:@"headingAccuracy"];
-
- result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:returnInfo];
- [result setKeepCallbackAsBool:bRetain];
- }
- if (result) {
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
- }
-}
-
-- (void)stopHeading:(CDVInvokedUrlCommand*)command
-{
- // CDVHeadingData* hData = self.headingData;
- if (self.headingData && (self.headingData.headingStatus != HEADINGSTOPPED)) {
- if (self.headingData.headingFilter) {
- // callback one last time to clear callback
- [self returnHeadingInfo:self.headingData.headingFilter keepCallback:NO];
- self.headingData.headingFilter = nil;
- }
- [self.locationManager stopUpdatingHeading];
- NSLog(@"heading STOPPED");
- self.headingData = nil;
- }
-}
-
-// helper method to check the orientation and start updating headings
-- (void)startHeadingWithFilter:(CLLocationDegrees)filter
-{
- // FYI UIDeviceOrientation and CLDeviceOrientation enums are currently the same
- self.locationManager.headingOrientation = (CLDeviceOrientation)self.viewController.interfaceOrientation;
- self.locationManager.headingFilter = filter;
- [self.locationManager startUpdatingHeading];
- self.headingData.headingStatus = HEADINGSTARTING;
-}
-
-- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager*)manager
-{
- return YES;
-}
-
-- (void)locationManager:(CLLocationManager*)manager
- didUpdateHeading:(CLHeading*)heading
-{
- CDVHeadingData* hData = self.headingData;
-
- // normally we would clear the delegate to stop getting these notifications, but
- // we are sharing a CLLocationManager to get location data as well, so we do a nil check here
- // ideally heading and location should use their own CLLocationManager instances
- if (hData == nil) {
- return;
- }
-
- // save the data for next call into getHeadingData
- hData.headingInfo = heading;
- BOOL bTimeout = NO;
- if (!hData.headingFilter && hData.headingTimestamp) {
- bTimeout = fabs([hData.headingTimestamp timeIntervalSinceNow]) > hData.timeout;
- }
-
- if (hData.headingStatus == HEADINGSTARTING) {
- hData.headingStatus = HEADINGRUNNING; // so returnHeading info will work
-
- // this is the first update
- for (NSString* callbackId in hData.headingCallbacks) {
- [self returnHeadingInfo:callbackId keepCallback:NO];
- }
-
- [hData.headingCallbacks removeAllObjects];
- }
- if (hData.headingFilter) {
- [self returnHeadingInfo:hData.headingFilter keepCallback:YES];
- } else if (bTimeout) {
- [self stopHeading:nil];
- }
- hData.headingStatus = HEADINGRUNNING; // to clear any error
-}
-
-- (void)locationManager:(CLLocationManager*)manager didFailWithError:(NSError*)error
-{
- NSLog(@"locationManager::didFailWithError %@", [error localizedFailureReason]);
-
- // Compass Error
- if ([error code] == kCLErrorHeadingFailure) {
- CDVHeadingData* hData = self.headingData;
- if (hData) {
- if (hData.headingStatus == HEADINGSTARTING) {
- // heading error during startup - report error
- for (NSString* callbackId in hData.headingCallbacks) {
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:0];
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
- }
-
- [hData.headingCallbacks removeAllObjects];
- } // else for frequency watches next call to getCurrentHeading will report error
- if (hData.headingFilter) {
- CDVPluginResult* resultFilter = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:0];
- [self.commandDelegate sendPluginResult:resultFilter callbackId:hData.headingFilter];
- }
- hData.headingStatus = HEADINGERROR;
- }
- }
-
- [self.locationManager stopUpdatingLocation];
- __locationStarted = NO;
-}
-
-- (void)dealloc
-{
- self.locationManager.delegate = nil;
-}
-
-- (void)onReset
-{
- [self.locationManager stopUpdatingHeading];
- self.headingData = nil;
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/src/tizen/CompassProxy.js
----------------------------------------------------------------------
diff --git a/src/tizen/CompassProxy.js b/src/tizen/CompassProxy.js
deleted file mode 100644
index 9746abc..0000000
--- a/src/tizen/CompassProxy.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var cordova = require('cordova'),
- CompassHeading = require('org.apache.cordova.device-orientation.CompassHeading'),
- CompassError = require('org.apache.cordova.device-orientation.CompassError');
-
-var compassCallback = null,
- compassReady = false;
-
-
-module.exports = {
- getHeading: function (successCallback, errorCallback) {
- if (window.DeviceOrientationEvent !== undefined) {
- compassCallback = function (orientation) {
- var heading = 360 - orientation.alpha;
-
- if (compassReady) {
- if (successCallback)
- successCallback( new CompassHeading (heading, heading, 0, 0));
- window.removeEventListener("deviceorientation", compassCallback, true);
- }
- compassReady = true;
- };
- compassReady = false; // workaround invalid first event value returned by WRT
- window.addEventListener("deviceorientation", compassCallback, true);
- }
- else {
- if (errorCallback)
- errorCallback(CompassError.COMPASS_NOT_SUPPORTED);
- }
- },
-
- stopHeading: function (successCallback, errorCallback) {
- console.log("Compass stopHeading: not implemented yet.");
- }
-};
-
-require("cordova/tizen/commandProxy").add("Compass", module.exports);
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/src/ubuntu/compass.cpp
----------------------------------------------------------------------
diff --git a/src/ubuntu/compass.cpp b/src/ubuntu/compass.cpp
deleted file mode 100644
index a2c3bee..0000000
--- a/src/ubuntu/compass.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.
- */
-
-#include "compass.h"
-
-DeviceOrientation::DeviceOrientation(Cordova *cordova): CPlugin(cordova), _validData(false) {
- _compass.connectToBackend();
- connect(&_compass, SIGNAL(readingChanged()), SLOT(updateSensor()));
- connect(&_compass, SIGNAL(sensorError(int)), SLOT(sensorError(int)));
-}
-
-void DeviceOrientation::getHeading(int scId, int ecId, QVariantMap options) {
- Q_UNUSED(options);
- if (_compass.isConnectedToBackend() || !_compass.start()) {
- this->callback(ecId, "CompassError.COMPASS_NOT_SUPPORTED");
- return;
- }
-
- _successCallbacks << scId;
- _errorCallbacks << ecId;
-
- if (_validData) {
- reportResult();
- return;
- }
-}
-
-void DeviceOrientation::sensorError(int error) {
- Q_UNUSED(error);
-
- for (int ecId: _errorCallbacks) {
- this->callback(ecId, "CompassError.COMPASS_INTERNAL_ERR");
- }
-
- _errorCallbacks.clear();
- _successCallbacks.clear();
- _validData = false;
-}
-
-void DeviceOrientation::reportResult() {
- QVariantMap obj;
-
- obj.insert("magneticHeading", _azymuth);
- obj.insert("trueHeading", _azymuth);
- obj.insert("headingAccuracy", _accuracy);
- obj.insert("timestamp", _timestamp);
-
- for (int scId: _successCallbacks) {
- this->cb(scId, obj);
- }
-
- _errorCallbacks.clear();
- _successCallbacks.clear();
-}
-
-void DeviceOrientation::updateSensor(){
- QCompassReading *heading = _compass.reading();
- _azymuth = heading->azimuth();
- _accuracy = heading->calibrationLevel();
- _timestamp = QDateTime::currentDateTime().toMSecsSinceEpoch();
-
- _validData = true;
- reportResult();
-}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/src/ubuntu/compass.h
----------------------------------------------------------------------
diff --git a/src/ubuntu/compass.h b/src/ubuntu/compass.h
deleted file mode 100644
index a1f421e..0000000
--- a/src/ubuntu/compass.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef COMPASS_H_HKFSAHKDFAS
-#define COMPASS_H_HKFSAHKDFAS
-
-#include <cplugin.h>
-#include <QCompass>
-#include <QtCore>
-
-class DeviceOrientation: public CPlugin {
- Q_OBJECT
-public:
- explicit DeviceOrientation(Cordova *cordova);
-
- virtual const QString fullName() override {
- return DeviceOrientation::fullID();
- }
-
- virtual const QString shortName() override {
- return "Compass";
- }
-
- static const QString fullID() {
- return "Compass";
- }
-
-public slots:
- void getHeading(int scId, int ecId, QVariantMap options);
-
-protected slots:
- void updateSensor();
- void sensorError(int error);
-
-private:
- void reportResult();
- QCompass _compass;
- QList<int> _successCallbacks;
- QList<int> _errorCallbacks;
-
- double _azymuth;
- double _accuracy;
- qtimestamp _timestamp;
- bool _validData;
-};
-
-#endif
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/src/windows8/CompassProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/CompassProxy.js b/src/windows8/CompassProxy.js
deleted file mode 100644
index 5b94d32..0000000
--- a/src/windows8/CompassProxy.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-/*jslint sloppy:true */
-/*global Windows:true, require, module, setTimeout */
-
-var cordova = require('cordova'),
- CompassHeading = require('org.apache.cordova.device-orientation.CompassHeading'),
- CompassError = require('org.apache.cordova.device-orientation.CompassError');
-
-
-module.exports = {
-
- onReadingChanged: null,
- getHeading: function (win, lose) {
- var deviceCompass = Windows.Devices.Sensors.Compass.getDefault();
- if (!deviceCompass) {
- setTimeout(function () {
- lose(CompassError.COMPASS_NOT_SUPPORTED);
- }, 0);
- } else {
-
- deviceCompass.reportInterval = Math.max(16, deviceCompass.minimumReportInterval);
-
- this.onReadingChanged = function (e) {
- var reading = e.reading,
- heading = new CompassHeading(reading.headingMagneticNorth, reading.headingTrueNorth, null, reading.timestamp);
- win(heading);
- };
- deviceCompass.addEventListener("readingchanged", this.onReadingChanged);
- }
- },
- stopHeading: function (win, lose) {
- var deviceCompass = Windows.Devices.Sensors.Compass.getDefault();
- if (!deviceCompass) {
- setTimeout(function () {
- lose(CompassError.COMPASS_NOT_SUPPORTED);
- }, 0);
- } else {
- deviceCompass.removeEventListener("readingchanged", this.onReadingChanged);
- this.onReadingChanged = null;
- deviceCompass.reportInterval = 0;
- win();
- }
-
- }
-};
-
-require("cordova/exec/proxy").add("Compass", module.exports);
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/src/wp/Compass.cs
----------------------------------------------------------------------
diff --git a/src/wp/Compass.cs b/src/wp/Compass.cs
deleted file mode 100644
index d1ce894..0000000
--- a/src/wp/Compass.cs
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- 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.
-*/
-
-using System;
-using System.Net;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Shapes;
-using DeviceCompass = Microsoft.Devices.Sensors.Compass;
-using System.Windows.Threading;
-using System.Runtime.Serialization;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Globalization;
-using System.Threading;
-using Microsoft.Devices.Sensors;
-
-namespace WPCordovaClassLib.Cordova.Commands
-{
-
- public class Compass : BaseCommand
- {
- #region Static members
-
- /// <summary>
- /// Status of listener
- /// </summary>
- private static int currentStatus;
-
- /// <summary>
- /// Id for get getCompass method
- /// </summary>
- private static string getCompassId = "getCompassId";
-
- /// <summary>
- /// Compass
- /// </summary>
- private static DeviceCompass compass = new DeviceCompass();
-
- /// <summary>
- /// Listeners for callbacks
- /// </summary>
- private static Dictionary<string, Compass> watchers = new Dictionary<string, Compass>();
-
- #endregion
-
- #region Status codes
-
- public const int Stopped = 0;
- public const int Starting = 1;
- public const int Running = 2;
- public const int ErrorFailedToStart = 4;
- public const int Not_Supported = 20;
-
- /*
- * // Capture error codes
- CompassError.COMPASS_INTERNAL_ERR = 0;
- CompassError.COMPASS_NOT_SUPPORTED = 20;
- * */
-
- #endregion
-
- #region CompassOptions class
- /// <summary>
- /// Represents Accelerometer options.
- /// </summary>
- [DataContract]
- public class CompassOptions
- {
- /// <summary>
- /// How often to retrieve the Acceleration in milliseconds
- /// </summary>
- [DataMember(IsRequired = false, Name = "frequency")]
- public int Frequency { get; set; }
-
- /// <summary>
- /// The change in degrees required to initiate a watchHeadingFilter success callback.
- /// </summary>
- [DataMember(IsRequired = false, Name = "filter")]
- public int Filter { get; set; }
-
- /// <summary>
- /// Watcher id
- /// </summary>
- [DataMember(IsRequired = false, Name = "id")]
- public string Id { get; set; }
-
- }
- #endregion
-
-
- /// <summary>
- /// Time the value was last changed
- /// </summary>
- //private DateTime lastValueChangedTime;
-
- /// <summary>
- /// Accelerometer options
- /// </summary>
- private CompassOptions compassOptions;
-
- //bool isDataValid;
-
- //bool calibrating = false;
-
- public Compass()
- {
-
- }
-
- /// <summary>
- /// Formats current coordinates into JSON format
- /// </summary>
- /// <returns>Coordinates in JSON format</returns>
- private string GetHeadingFormatted(CompassReading reading)
- {
- // NOTE: timestamp is generated on the JS side, to avoid issues with format conversions
- string result = String.Format("\"magneticHeading\":{0},\"headingAccuracy\":{1},\"trueHeading\":{2}",
- reading.MagneticHeading.ToString("0.0", CultureInfo.InvariantCulture),
- reading.HeadingAccuracy.ToString("0.0", CultureInfo.InvariantCulture),
- reading.TrueHeading.ToString("0.0", CultureInfo.InvariantCulture));
- return "{" + result + "}";
- }
-
- public void getHeading(string options)
- {
- if (!DeviceCompass.IsSupported)
- {
- DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, Not_Supported));
- }
- else
- {
- //if (compass == null)
- //{
- // // Instantiate the compass.
- // compass = new DeviceCompass();
- // compass.TimeBetweenUpdates = TimeSpan.FromMilliseconds(40);
- // compass.CurrentValueChanged += new EventHandler<Microsoft.Devices.Sensors.SensorReadingEventArgs<Microsoft.Devices.Sensors.CompassReading>>(compass_CurrentValueChanged);
- // compass.Calibrate += new EventHandler<Microsoft.Devices.Sensors.CalibrationEventArgs>(compass_Calibrate);
- //}
-
-
- //compass.Start();
-
- }
-
- try
- {
- if (currentStatus != Running)
- {
- lock (compass)
- {
- compass.CurrentValueChanged += compass_SingleHeadingValueChanged;
- compass.Start();
- this.SetStatus(Starting);
- }
-
- long timeout = 2000;
- while ((currentStatus == Starting) && (timeout > 0))
- {
- timeout = timeout - 100;
- Thread.Sleep(100);
- }
-
- if (currentStatus != Running)
- {
- DispatchCommandResult(new PluginResult(PluginResult.Status.IO_EXCEPTION, ErrorFailedToStart));
- return;
- }
- }
- lock (compass)
- {
- compass.CurrentValueChanged -= compass_SingleHeadingValueChanged;
- if (watchers.Count < 1)
- {
- compass.Stop();
- this.SetStatus(Stopped);
- }
- }
- }
- catch (UnauthorizedAccessException)
- {
- DispatchCommandResult(new PluginResult(PluginResult.Status.ILLEGAL_ACCESS_EXCEPTION, ErrorFailedToStart));
- }
- catch (Exception)
- {
- DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, ErrorFailedToStart));
- }
- }
-
- void compass_SingleHeadingValueChanged(object sender, Microsoft.Devices.Sensors.SensorReadingEventArgs<CompassReading> e)
- {
- this.SetStatus(Running);
- if (compass.IsDataValid)
- {
- // trueHeading :: The heading in degrees from 0 - 359.99 at a single moment in time.
- // magneticHeading:: The heading relative to the geographic North Pole in degrees 0 - 359.99 at a single moment in time.
- // A negative value indicates that the true heading could not be determined.
- // headingAccuracy :: The deviation in degrees between the reported heading and the true heading.
- //rawMagnetometerReading = e.SensorReading.MagnetometerReading;
-
- //Debug.WriteLine("Compass Result :: " + GetHeadingFormatted(e.SensorReading));
-
- PluginResult result = new PluginResult(PluginResult.Status.OK, GetHeadingFormatted(e.SensorReading));
-
- DispatchCommandResult(result);
- }
- }
-
- /// <summary>
- /// Starts listening for compass sensor
- /// </summary>
- /// <returns>status of listener</returns>
- private int start()
- {
- if ((currentStatus == Running) || (currentStatus == Starting))
- {
- return currentStatus;
- }
- try
- {
- lock (compass)
- {
- watchers.Add(getCompassId, this);
- compass.CurrentValueChanged += watchers[getCompassId].compass_CurrentValueChanged;
- compass.Start();
- this.SetStatus(Starting);
- }
- }
- catch (Exception)
- {
- this.SetStatus(ErrorFailedToStart);
- }
- return currentStatus;
- }
-
- public void startWatch(string options)
- {
- if (!DeviceCompass.IsSupported)
- {
- DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, Not_Supported));
- }
-
- try
- {
- compassOptions = JSON.JsonHelper.Deserialize<CompassOptions>(options);
- }
- catch (Exception ex)
- {
- this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message));
- return;
- }
-
- if (string.IsNullOrEmpty(compassOptions.Id))
- {
- this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
- return;
- }
-
- try
- {
- lock (compass)
- {
- watchers.Add(compassOptions.Id, this);
- compass.CurrentValueChanged += watchers[compassOptions.Id].compass_CurrentValueChanged;
- compass.Start();
- this.SetStatus(Starting);
- }
- }
- catch (Exception)
- {
- this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, ErrorFailedToStart));
- return;
- }
- }
-
- public void stopWatch(string options)
- {
- try
- {
- compassOptions = JSON.JsonHelper.Deserialize<CompassOptions>(options);
- }
- catch (Exception ex)
- {
- this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message));
- return;
- }
-
- if (string.IsNullOrEmpty(compassOptions.Id))
- {
- this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
- return;
- }
-
- if (currentStatus != Stopped)
- {
- lock (compass)
- {
- Compass watcher = watchers[compassOptions.Id];
- compass.CurrentValueChanged -= watcher.compass_CurrentValueChanged;
- watchers.Remove(compassOptions.Id);
- watcher.Dispose();
- }
- }
- this.SetStatus(Stopped);
-
- this.DispatchCommandResult();
- }
-
- void compass_Calibrate(object sender, Microsoft.Devices.Sensors.CalibrationEventArgs e)
- {
- //throw new NotImplementedException();
- // TODO: pass calibration error to JS
- }
-
- void compass_CurrentValueChanged(object sender, Microsoft.Devices.Sensors.SensorReadingEventArgs<CompassReading> e)
- {
- this.SetStatus(Running);
- if (compass.IsDataValid)
- {
- // trueHeading :: The heading in degrees from 0 - 359.99 at a single moment in time.
- // magneticHeading:: The heading relative to the geographic North Pole in degrees 0 - 359.99 at a single moment in time.
- // A negative value indicates that the true heading could not be determined.
- // headingAccuracy :: The deviation in degrees between the reported heading and the true heading.
- //rawMagnetometerReading = e.SensorReading.MagnetometerReading;
-
- //Debug.WriteLine("Compass Result :: " + GetHeadingFormatted(e.SensorReading));
-
- PluginResult result = new PluginResult(PluginResult.Status.OK, GetHeadingFormatted(e.SensorReading));
- result.KeepCallback = true;
-
- DispatchCommandResult(result);
- }
- }
-
- /// <summary>
- /// Sets current status
- /// </summary>
- /// <param name="status">current status</param>
- private void SetStatus(int status)
- {
- currentStatus = status;
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/www/CompassError.js
----------------------------------------------------------------------
diff --git a/www/CompassError.js b/www/CompassError.js
deleted file mode 100644
index 7b5b485..0000000
--- a/www/CompassError.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-/**
- * CompassError.
- * An error code assigned by an implementation when an error has occurred
- * @constructor
- */
-var CompassError = function(err) {
- this.code = (err !== undefined ? err : null);
-};
-
-CompassError.COMPASS_INTERNAL_ERR = 0;
-CompassError.COMPASS_NOT_SUPPORTED = 20;
-
-module.exports = CompassError;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/www/CompassHeading.js
----------------------------------------------------------------------
diff --git a/www/CompassHeading.js b/www/CompassHeading.js
deleted file mode 100644
index 70343ee..0000000
--- a/www/CompassHeading.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, timestamp) {
- this.magneticHeading = magneticHeading;
- this.trueHeading = trueHeading;
- this.headingAccuracy = headingAccuracy;
- this.timestamp = timestamp || new Date().getTime();
-};
-
-module.exports = CompassHeading;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/0061de92/www/compass.js
----------------------------------------------------------------------
diff --git a/www/compass.js b/www/compass.js
deleted file mode 100644
index d2be118..0000000
--- a/www/compass.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var argscheck = require('cordova/argscheck'),
- exec = require('cordova/exec'),
- utils = require('cordova/utils'),
- CompassHeading = require('./CompassHeading'),
- CompassError = require('./CompassError'),
-
- timers = {},
- compass = {
- /**
- * Asynchronously acquires 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 {CompassOptions} options The options for getting the heading data (not used).
- */
- getCurrentHeading:function(successCallback, errorCallback, options) {
- argscheck.checkArgs('fFO', 'compass.getCurrentHeading', arguments);
-
- var win = function(result) {
- var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp);
- successCallback(ch);
- };
- var fail = errorCallback && function(code) {
- var ce = new CompassError(code);
- errorCallback(ce);
- };
-
- // Get heading
- exec(win, fail, "Compass", "getHeading", [options]);
- },
-
- /**
- * Asynchronously acquires 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. For iOS, filter parameter
- * specifies to watch via a distance filter rather than time.
- */
- watchHeading:function(successCallback, errorCallback, options) {
- argscheck.checkArgs('fFO', 'compass.watchHeading', arguments);
- // Default interval (100 msec)
- var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
- var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0;
-
- var id = utils.createUUID();
- if (filter > 0) {
- // is an iOS request for watch by filter, no timer needed
- timers[id] = "iOS";
- compass.getCurrentHeading(successCallback, errorCallback, options);
- } else {
- // Start watch timer to get headings
- timers[id] = window.setInterval(function() {
- compass.getCurrentHeading(successCallback, errorCallback);
- }, frequency);
- }
-
- return id;
- },
-
- /**
- * Clears the specified heading watch.
- * @param {String} watchId The ID of the watch returned from #watchHeading.
- */
- clearWatch:function(id) {
- // Stop javascript timer & remove from timer list
- if (id && timers[id]) {
- if (timers[id] != "iOS") {
- clearInterval(timers[id]);
- } else {
- // is iOS watch by filter so call into device to stop
- exec(null, null, "Compass", "stopHeading", []);
- }
- delete timers[id];
- }
- }
- };
-
-module.exports = compass;