Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
6861c0ac
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
You need to sign in or sign up before continuing.
提交
6861c0ac
编写于
8月 30, 2022
作者:
C
cff-gite
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改3.2分支
Signed-off-by:
N
cff-gite
<
chenfeifei8@huawei.com
>
上级
fb498bc2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
12 deletion
+12
-12
zh-cn/application-dev/reference/apis/js-apis-sensor.md
zh-cn/application-dev/reference/apis/js-apis-sensor.md
+12
-12
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-sensor.md
浏览文件 @
6861c0ac
...
...
@@ -1648,7 +1648,7 @@ transformCoordinateSystem(inRotationVector: Array<number>, coordinates: Co
**示例:**
```
js
sensor
.
transformCoordinateSystem
([
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
],
{
x
:
2
,
y
:
3
},
function
(
err
,
data
)
{
sensor
.
transformCoordinateSystem
([
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
],
{
'
x
'
:
2
,
'
y
'
:
3
},
function
(
err
,
data
)
{
if
(
err
)
{
console
.
error
(
"
Operation failed. Error code:
"
+
err
.
code
+
"
, message:
"
+
err
.
message
);
return
;
...
...
@@ -1683,7 +1683,7 @@ transformCoordinateSystem(inRotationVector: Array<number>, coordinates: Co
**示例:**
```
js
const
promise
=
sensor
.
transformCoordinateSystem
([
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
],
{
x
:
2
,
y
:
3
});
const
promise
=
sensor
.
transformCoordinateSystem
([
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
],
{
'
x
'
:
2
,
'
y
'
:
3
});
promise
.
then
((
data
)
=>
{
console
.
info
(
"
Operation successed.
"
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
...
...
@@ -1711,12 +1711,12 @@ getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callba
**示例:**
```
js
sensor
.
getGeomagneticField
({
latitude
:
80
,
longitude
:
0
,
altitude
:
0
},
1580486400000
,
function
(
err
,
data
)
{
sensor
.
getGeomagneticField
({
'
latitude
'
:
80
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
1580486400000
,
function
(
err
,
data
)
{
if
(
err
)
{
console
.
error
(
'
Operation failed. Error code:
'
+
err
.
code
+
'
; message:
'
+
err
.
message
);
return
;
}
console
.
info
(
'
sensor_getGeomagneticField_
promise
x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
console
.
info
(
'
sensor_getGeomagneticField_
callback
x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
);
});
...
...
@@ -1742,7 +1742,7 @@ getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promi
**示例:**
```
js
const
promise
=
sensor
.
getGeomagneticField
({
latitude
:
80
,
longitude
:
0
,
altitude
:
0
},
1580486400000
);
const
promise
=
sensor
.
getGeomagneticField
({
'
latitude
'
:
80
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
1580486400000
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
sensor_getGeomagneticField_promise x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
...
...
@@ -1898,7 +1898,7 @@ getAngleModify(currentRotationMatrix: Array<number>, preRotationMatrix: Ar
err
.
message
);
return
;
}
console
.
info
(
"
SensorJsAPI--->Successed to get getAngleModifiy interface get data:
"
+
data
.
x
);
console
.
info
(
"
SensorJsAPI--->Successed to get getAngleModifiy interface get data:
"
+
data
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
"
data[
"
+
i
+
"
]:
"
+
data
[
i
]);
}
...
...
@@ -1966,7 +1966,7 @@ createRotationMatrix(rotationVector: Array<number>, callback: AsyncCallbac
err
.
message
);
return
;
}
console
.
info
(
"
SensorJsAPI--->Successed to get createRotationMatrix interface get data:
"
+
data
.
x
);
console
.
info
(
"
SensorJsAPI--->Successed to get createRotationMatrix interface get data:
"
+
data
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
"
data[
"
+
i
+
"
]:
"
+
data
[
i
]);
}
...
...
@@ -2033,7 +2033,7 @@ createQuaternion(rotationVector: Array<number>, callback: AsyncCallback<
err
.
message
);
return
;
}
console
.
info
(
"
SensorJsAPI--->Successed to get createQuaternion interface get data:
"
+
data
.
x
);
console
.
info
(
"
SensorJsAPI--->Successed to get createQuaternion interface get data:
"
+
data
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
"
data[
"
+
i
+
"
]:
"
+
data
[
i
]);
}
...
...
@@ -2168,7 +2168,7 @@ createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number&
err
.
message
);
return
;
}
console
.
info
(
"
SensorJsAPI--->Successed to get createRotationMatrix interface get data:
"
+
data
.
x
);
console
.
info
(
"
SensorJsAPI--->Successed to get createRotationMatrix interface get data:
"
+
data
);
for
(
var
i
=
0
;
i
<
data
.
rotation
.
length
;
i
++
)
{
console
.
info
(
"
data[
"
+
i
+
"
]:
"
+
data
[
i
])
}
...
...
@@ -2417,9 +2417,9 @@ createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number&
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称
| 参数类型 | 可读 | 可写 | 说明
|
| ------ | ------
| ---- | ---- |
--------------------------------- |
| status | number
| 是 | 是 | 显示霍尔状态。测量设备周围是否存在磁力吸引,0表示有,1表示没
有。 |
| 名称
| 参数类型 | 可读 | 可写 | 说明
|
| ------ | ------
-- | ---- | ---- | ---------------------------
--------------------------------- |
| status | number
| 是 | 是 | 显示霍尔状态。测量设备周围是否存在磁力吸引,0表示没有,1表示
有。 |
## MagneticFieldResponse
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录