| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 | 
							- <!DOCTYPE HTML>
 
- <html>
 
- <head>
 
- <meta charset="utf-8">
 
- <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
 
- <meta name="HandheldFriendly" content="true">
 
- <meta name="MobileOptimized" content="320">
 
- <title>Orientation Document</title>
 
- <link rel="stylesheet" type="text/css" href="res/doc.css" charset="utf-8">
 
- <link rel="stylesheet" type="text/css" href="res/prettify.sons.css" charset="utf-8">
 
- <script type="text/javascript" src="res/doc.js" charset="utf-8"></script><script type="text/javascript" src="res/prettify.js" charset="utf-8"></script>
 
- </head>
 
- <body><div id="content" class="content">
 
- <h1><a name="plus.orientation">orientation</a></h1>
 
- <p>Orientation模块管理设备的方向信息,包括alpha、beta、gamma三个方向信息,通过plus.orientation可获取设备方向管理对象。</p>
 
- <h2>方法:</h2>
 
- <ul>
 
- <li>
 
- <a href="#plus.orientation.getCurrentOrientation">getCurrentOrientation</a>: 获取当前设备的方向信息,包括alpha、beta、gamma三个方向信息</li>
 
- <li>
 
- <a href="#plus.orientation.watchOrientation">watchOrientation</a>: 监听设备方向信息的变化</li>
 
- <li>
 
- <a href="#plus.orientation.clearWatch">clearWatch</a>: 关闭监听设备方向信息</li>
 
- </ul>
 
- <h2>对象:</h2>
 
- <ul>
 
- <li>
 
- <a href="#plus.orientation.OrientationOption">OrientationOption</a>: JSON对象,监听设备方向感应器参数</li>
 
- <li>
 
- <a href="#plus.orientation.Rotation">Rotation</a>: JSON对象,设备方向信息数据</li>
 
- </ul>
 
- <h2>回调方法:</h2>
 
- <ul>
 
- <li>
 
- <a href="#plus.orientation.OrientationSuccessCallback">OrientationSuccessCallback</a>: 获取设备方向信息成功的回调函数</li>
 
- <li>
 
- <a href="#plus.orientation.OrientationErrorCallback">OrientationErrorCallback</a>: 获取设备方向信息失败的回调函数</li>
 
- </ul>
 
- <h2>权限:</h2>
 
- <p>5+功能模块(permissions)</p>
 
- <pre class="prettyprint linenums">
 
- {
 
- // ...
 
- "permissions":{
 
- 	// ...
 
- 	"Orientation": {
 
- 		"description": "方向传感器"
 
- 	}
 
- }
 
- }
 
- 			</pre>
 
- <h1><a name="plus.orientation.OrientationOption">OrientationOption</a></h1>
 
- <p>JSON对象,监听设备方向感应器参数</p>
 
- <h2>属性:</h2>
 
- <ul><li>frequency: <em>(<font class="type">Number</font>
 
- 	类型
 
- )</em>更新方向信息的时间间隔<br><p>数值类型,单位为ms,默认值为500ms。</p>
 
- </li></ul>
 
- <h1><a name="plus.orientation.Rotation">Rotation</a></h1>
 
- <p>JSON对象,设备方向信息数据</p>
 
- <pre class="prettyprint linenums">
 
- interface Rotation {
 
- 	readonly attribute float alpha;
 
- 	readonly attribute float beta;
 
- 	readonly attribute float gamma;
 
- 	readonly attribute float magneticHeading;
 
- 	readonly attribute float trueHeading;
 
- 	readonly attribute float headingAccuracy;
 
- }
 
- 				</pre>
 
- <h2>属性:</h2>
 
- <ul>
 
- <li>alpha: <em>(<font class="type">float</font>
 
- 	类型
 
- )</em>以z方向为轴心的旋转角度<br><p>浮点数类型,只读属性,取值范围为0到360(不等于360)。</p>
 
- </li>
 
- <li>beta: <em>(<font class="type">float</font>
 
- 	类型
 
- )</em>以x方向为轴心的旋转角度<br><p>浮点数类型,只读属性,取值范围为-180到180(不等于180)。</p>
 
- </li>
 
- <li>gamma: <em>(<font class="type">float</font>
 
- 	类型
 
- )</em>以y方向为轴心的旋转角度<br><p>浮点数类型,只读属性,取值范围为-180到180(不等于180)。</p>
 
- </li>
 
- <li>magneticHeading: <em>(<font class="type">float</font>
 
- 	类型
 
- )</em>设备方向与地球磁场北极方向的角度<br><p>浮点数类型,只读属性,取值范围为0到360(不等于360)。</p>
 
- </li>
 
- <li>trueHeading: <em>(<font class="type">float</font>
 
- 	类型
 
- )</em>设备方向与地球真实北极方向的角度<br><p>浮点数类型,只读属性,取值范围为0到360(不等于360)。</p>
 
- </li>
 
- <li>headingAccuracy: <em>(<font class="type">float</font>
 
- 	类型
 
- )</em>设备方向值的误差值<br><p>浮点数类型,只读属性,取值范围为0到360(不等于360)。</p>
 
- </li>
 
- </ul>
 
- <h1><a name="plus.orientation.OrientationSuccessCallback">OrientationSuccessCallback</a></h1>
 
- <p>获取设备方向信息成功的回调函数</p>
 
- <pre class="prettyprint linenums">
 
- void onSuccess( rotation ){
 
- 	// Get orientation success code.
 
- }
 
- 				</pre>
 
- <h2>参数:</h2>
 
- <ul><li>rotation: 
 
- 		<em>(
 
- 			<font class="type">DOMString</font>
 
- 			)
 
- 			必选 </em>设备的方向信息Rotation<br>
 
- </li></ul>
 
- <h2>返回值:</h2>
 
- <font class="type">void</font>
 
- 			: 无<h1><a name="plus.orientation.OrientationErrorCallback">OrientationErrorCallback</a></h1>
 
- <p>获取设备方向信息失败的回调函数</p>
 
- <pre class="prettyprint linenums">
 
- void onError( error ) {
 
- 	// Get orientation error code. 
 
- }
 
- 				</pre>
 
- <h2>参数:</h2>
 
- <ul><li>error: 
 
- 		<em>(
 
- 			<font class="type">DOMException</font>
 
- 			)
 
- 			必选 </em>失败信息<br>
 
- </li></ul>
 
- <h2>返回值:</h2>
 
- <font class="type">void</font>
 
- 			: 无<br><br>
 
- </div></body>
 
- </html>
 
 
  |