Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
e6186d72
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
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看板
提交
e6186d72
编写于
9月 28, 2022
作者:
C
cff-gite
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改资料
Signed-off-by:
N
cff-gite
<
chenfeifei8@huawei.com
>
上级
5874d864
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
32 deletion
+39
-32
zh-cn/application-dev/reference/apis/js-apis-sensor.md
zh-cn/application-dev/reference/apis/js-apis-sensor.md
+39
-32
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-sensor.md
浏览文件 @
e6186d72
...
...
@@ -23,7 +23,7 @@ import sensor from '@ohos.sensor';
## sensor.on
### ACCELEROMETER
<sup>9+</sup>
### ACCELEROMETER<sup>9+</sup>
on(type: SensorId.ACCELEROMETER, callback: Callback
<
AccelerometerResponse
>
,options?: Options): void
...
...
@@ -53,7 +53,7 @@ sensor.on(sensor.SensorId.ACCELEROMETER,function(data){
);
```
### ACCELEROMETER_UNCALIBRATED
<sup>9+</sup>
### ACCELEROMETER_UNCALIBRATED<sup>9+</sup>
on(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback:Callback
<
AccelerometerUncalibratedResponse
>
,options?: Options): void
...
...
@@ -86,7 +86,7 @@ on(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback:Callback<Accelerometer
);
```
### AMBIENT_LIGHT
<sup>9+</sup>
### AMBIENT_LIGHT<sup>9+</sup>
on(type: SensorId.AMBIENT_LIGHT, callback: Callback
<
LightResponse
>
, options?: Options): void
...
...
@@ -112,7 +112,7 @@ on(type: SensorId.AMBIENT_LIGHT, callback: Callback<LightResponse>, option
);
```
### AMBIENT_TEMPERATURE
<sup>9+</sup>
### AMBIENT_TEMPERATURE<sup>9+</sup>
on(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback
<
AmbientTemperatureResponse
>
,options?: Options): void
...
...
@@ -138,7 +138,7 @@ on(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureR
);
```
### BAROMETER
<sup>9+</sup>
### BAROMETER<sup>9+</sup>
on(type: SensorId.BAROMETER, callback: Callback
<
BarometerResponse
>
, options?: Options): void
...
...
@@ -164,7 +164,7 @@ on(type: SensorId.BAROMETER, callback: Callback<BarometerResponse>, option
);
```
### GRAVITY
<sup>9+</sup>
### GRAVITY<sup>9+</sup>
on(type: SensorId.GRAVITY, callback: Callback
<
GravityResponse
>
,options?: Options): void
...
...
@@ -192,7 +192,7 @@ on(type: SensorId.GRAVITY, callback: Callback<GravityResponse>,options?: O
);
```
### GYROSCOPE
<sup>9+</sup>
### GYROSCOPE<sup>9+</sup>
on(type: SensorId.GYROSCOPE, callback: Callback
<
GyroscopeResponse
>
,options?: Options): void
...
...
@@ -222,7 +222,7 @@ on(type: SensorId.GYROSCOPE, callback: Callback<GyroscopeResponse>,options
);
```
### GYROSCOPE_UNCALIBRATED
<sup>9+</sup>
### GYROSCOPE_UNCALIBRATED<sup>9+</sup>
on(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback
<
GyroscopeUncalibratedResponse
>
,
options?: Options): void
...
...
@@ -256,7 +256,7 @@ on(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalib
);
```
### HALL
<sup>9+</sup>
### HALL<sup>9+</sup>
on(type: SensorId.HALL, callback: Callback
<
HallResponse
>
, options?: Options): void
...
...
@@ -282,7 +282,7 @@ on(type: SensorId.HALL, callback: Callback<HallResponse>, options?: Option
);
```
### HEART_RATE
<sup>9+</sup>
### HEART_RATE<sup>9+</sup>
on(type: SensorId.HEART_RATE, callback: Callback
<
HeartRateResponse
>
,options?: Options): void
...
...
@@ -310,7 +310,7 @@ sensor.on(sensor.SensorId.HEART_RATE,function(data){
);
```
### HUMIDITY
<sup>9+</sup>
### HUMIDITY<sup>9+</sup>
on(type: SensorId.HUMIDITY, callback: Callback
<
HumidityResponse
>
,options?: Options): void
...
...
@@ -366,7 +366,7 @@ on(type: SensorId.LINEAR_ACCELERATION, callback: Callback<LinearAccelerometer
);
```
### MAGNETIC_FIELD
<sup>9+</sup>
### MAGNETIC_FIELD<sup>9+</sup>
on(type: SensorId.MAGNETIC_FIELD, callback: Callback
<
MagneticFieldResponse
>
,options?: Options): void
...
...
@@ -394,7 +394,7 @@ on(type: SensorId.MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>
);
```
### MAGNETIC_FIELD_UNCALIBRATED
<sup>9+</sup>
### MAGNETIC_FIELD_UNCALIBRATED<sup>9+</sup>
on(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED,callback:Callback
<
MagneticFieldUncalibratedResponse
>
,
options?: Options): void
...
...
@@ -426,7 +426,7 @@ on(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED,callback:Callback<MagneticField
);
```
### ORIENTATION
<sup>9+</sup>
### ORIENTATION<sup>9+</sup>
on(type: SensorId.ORIENTATION, callback: Callback
<
OrientationResponse
>
,options?: Options): void
...
...
@@ -454,7 +454,7 @@ on(type: SensorId.ORIENTATION, callback: Callback<OrientationResponse>,opt
);
```
### PEDOMETER
<sup>9+</sup>
### PEDOMETER<sup>9+</sup>
on(type: SensorId.PEDOMETER, callback: Callback
<
PedometerResponse
>
, options?: Options): void
...
...
@@ -482,7 +482,7 @@ on(type: SensorId.PEDOMETER, callback: Callback<PedometerResponse>, option
);
```
### PEDOMETER_DETECTION
<sup>9+</sup>
### PEDOMETER_DETECTION<sup>9+</sup>
on(type: SensorId.PEDOMETER_DETECTION, callback: Callback
<
PedometerDetectionResponse
>
,
options?: Options): void
...
...
@@ -511,7 +511,7 @@ on(type: SensorId.PEDOMETER_DETECTION, callback: Callback<PedometerDetectionR
);
```
### PROXIMITY
<sup>9+</sup>
### PROXIMITY<sup>9+</sup>
on(type: SensorId.PROXIMITY, callback: Callback
<
ProximityResponse
>
, options?: Options): void
...
...
@@ -537,7 +537,7 @@ on(type: SensorId.PROXIMITY, callback: Callback<ProximityResponse>, option
);
```
### ROTATION_VECTOR
<sup>9+</sup>
### ROTATION_VECTOR<sup>9+</sup>
on(type: SensorId.ROTATION_VECTOR, callback: Callback
<
RotationVectorResponse
>
,
options?: Options): void
...
...
@@ -567,7 +567,7 @@ on(type: SensorId.ROTATION_VECTOR, callback: Callback<RotationVectorResponse&
);
```
### SIGNIFICANT_MOTION
<sup>9+</sup>
### SIGNIFICANT_MOTION<sup>9+</sup>
on(type: SensorId.SIGNIFICANT_MOTION, callback: Callback
<
SignificantMotionResponse
>
,
options?: Options): void
...
...
@@ -594,7 +594,7 @@ on(type: SensorId.SIGNIFICANT_MOTION, callback: Callback<SignificantMotionRes
);
```
### WEAR_DETECTION
<sup>9+</sup>
### WEAR_DETECTION<sup>9+</sup>
on(type: SensorId.WEAR_DETECTION, callback: Callback
<
WearDetectionResponse
>
,
options?: Options): void
...
...
@@ -623,7 +623,7 @@ on(type: SensorId.WEAR_DETECTION, callback: Callback<WearDetectionResponse>
## sensor.once
### ACCELEROMETER
<sup>9+</sup>
### ACCELEROMETER<sup>9+</sup>
once(type: SensorId.ACCELEROMETER, callback: Callback
<
AccelerometerResponse
>
): void
...
...
@@ -651,7 +651,7 @@ once(type: SensorId.ACCELEROMETER, callback: Callback<AccelerometerResponse&g
);
```
### ACCELEROMETER_UNCALIBRATED
<sup>9+</sup>
### ACCELEROMETER_UNCALIBRATED<sup>9+</sup>
once(type: SensorId.ACCELEROMETER_UNCALIBRATED,callback:Callback
<
AccelerometerUncalibratedResponse
>
): void
...
...
@@ -682,7 +682,7 @@ once(type: SensorId.ACCELEROMETER_UNCALIBRATED,callback:Callback<Acceleromete
);
```
### AMBIENT_LIGHT
<sup>9+</sup>
### AMBIENT_LIGHT<sup>9+</sup>
once(type: SensorId.AMBIENT_LIGHT, callback: Callback
<
LightResponse
>
): void
...
...
@@ -706,7 +706,7 @@ once(type: SensorId.AMBIENT_LIGHT, callback: Callback<LightResponse>): voi
);
```
### AMBIENT_TEMPERATURE
<sup>9+</sup>
### AMBIENT_TEMPERATURE<sup>9+</sup>
once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback
<
AmbientTemperatureResponse
>
): void
...
...
@@ -729,7 +729,7 @@ once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatur
);
```
### BAROMETER
<sup>9+</sup>
### BAROMETER<sup>9+</sup>
once(type: SensorId.BAROMETER, callback: Callback
<
BarometerResponse
>
): void
...
...
@@ -752,7 +752,7 @@ once(type: SensorId.BAROMETER, callback: Callback<BarometerResponse>): voi
);
```
### GRAVITY
<sup>9+</sup>
### GRAVITY<sup>9+</sup>
once(type: SensorId.GRAVITY, callback: Callback
<
GravityResponse
>
): void
...
...
@@ -778,7 +778,7 @@ once(type: SensorId.GRAVITY, callback: Callback<GravityResponse>): void
);
```
### GYROSCOPE
<sup>9+</sup>
### GYROSCOPE<sup>9+</sup>
once(type: SensorId.GYROSCOPE, callback: Callback
<
GyroscopeResponse
>
): void
...
...
@@ -806,7 +806,7 @@ once(type: SensorId.GYROSCOPE, callback: Callback<GyroscopeResponse>): voi
);
```
### GYROSCOPE_UNCALIBRATED
<sup>9+</sup>
### GYROSCOPE_UNCALIBRATED<sup>9+</sup>
once(type:
...
...
@@ -839,7 +839,7 @@ sensor.once(sensor.SensorId.GYROSCOPE_UNCALIBRATED, function(data) {
);
```
### HALL
<sup>9+</sup>
### HALL<sup>9+</sup>
once(type: SensorId.HALL, callback: Callback
<
HallResponse
>
): void
...
...
@@ -863,7 +863,7 @@ sensor.once(sensor.SensorId.HALL, function(data) {
);
```
### HEART_RATE
<sup>9+</sup>
### HEART_RATE<sup>9+</sup>
once(type: SensorId.HEART_RATE, callback: Callback
<
HeartRateResponse
>
): void
...
...
@@ -1736,7 +1736,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<Acceler
监听加速度传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
从API Version9开始该接口不再维护,请使用
[
sensor.on.ACCELEROMETER
](
#accelerometer
<sup>
9+
</sup>
)
从API Version9开始该接口不再维护,请使用
[
zh-cn/application-dev/reference/apis/js-apis-sensor.md · OpenHarmony/docs - Gitee.com
](
https://gitee.com/openharmony/docs/blob/5874d864fc967bf36d039d5b29766243cbfa0bc5/zh-cn/application-dev/reference/apis/js-apis-sensor.md#accelerometer-9
)
**需要权限**
:ohos.permission.ACCELEROMETER
...
...
@@ -1809,17 +1809,20 @@ on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER,callback:Callback<Lin
);
```
### ACCELEROMETER_UNCALIBRATED
### ACCELEROMETER_UNCALIBRATED
<sup>(deprecated)</sup>
on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback: Callback
<
AccelerometerUncalibratedResponse
>
, options?: Options): void
监听未校准加速度计传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
从API Version9开始该接口不再维护,请使用
[
zh-cn/application-dev/reference/apis/js-apis-sensor.md · OpenHarmony/docs - Gitee.com
](
https://gitee.com/openharmony/docs/blob/5874d864fc967bf36d039d5b29766243cbfa0bc5/zh-cn/application-dev/reference/apis/js-apis-sensor.md#accelerometer_uncalibrated-9
)
**需要权限**
:ohos.permission.ACCELEROMETER
**系统能力**
:SystemCapability.Sensors.Sensor
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type |
[
SensorType
](
#sensortype
)
| 是 | 要订阅的未校准加速度计传感器类型为SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED。 |
...
...
@@ -2338,6 +2341,10 @@ once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<Accele
监听加速度传感器的数据变化一次。
从API Version9开始该接口不再维护,请使用
[
sensor.once.ACCELEROMETER
](
#accelerometer
<sup>
9+
</sup>
)
从API Version9开始该接口不再维护,请使用
[
sensor.once.ACCELEROMETER
](
#accelerometer9-1
)
**需要权限**
:ohos.permission.ACCELEROMETER
**系统能力**
:SystemCapability.Sensors.Sensor
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录