提交 74ccfcab 编写于 作者: C cff-gite

修改sensor和vibrator的syscap

Signed-off-by: Ncff-gite <chenfeifei8@huawei.com>
上级 34c3c50f
...@@ -10,28 +10,17 @@ ...@@ -10,28 +10,17 @@
import sensor from '@ohos.sensor'; import sensor from '@ohos.sensor';
``` ```
## 系统能力
SystemCapability.Sensors.Sensor
## 权限列表
计步器:ohos.permission.ACTIVITY_MOTION
心率:ohos.permission.READ_HEALTH_DATA
加速度:ohos.permission.ACCELEROMETER
陀螺仪:ohos.permission.GYROSCOPE
## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER) ## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER)
on(type: sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallback&lt;AccelerometerResponse&gt;,options?: Options): void on(type: sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallback&lt;AccelerometerResponse&gt;,options?: Options): void
监听加速度传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听加速度传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**需要权限**:ohos.permission.ACCELEROMETER ,该权限为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -62,6 +51,10 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:AsyncCallb ...@@ -62,6 +51,10 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:AsyncCallb
监听线性加速度传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听线性加速度传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**需要权限**:ohos.permission.ACCELEROMETER ,该权限为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -91,6 +84,10 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback:Asy ...@@ -91,6 +84,10 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback:Asy
监听未校准加速度计传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听未校准加速度计传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**需要权限**:ohos.permission.ACCELEROMETER ,该权限为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -123,6 +120,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback&lt;Gr ...@@ -123,6 +120,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback&lt;Gr
监听重力传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听重力传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -152,6 +151,10 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback&lt; ...@@ -152,6 +151,10 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback&lt;
监听陀螺仪传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听陀螺仪传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**需要权限**:ohos.permission.GRYOSCOPE ,该权限为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -181,6 +184,10 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:AsyncCa ...@@ -181,6 +184,10 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:AsyncCa
监听未校准陀螺仪传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听未校准陀螺仪传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**需要权限**:ohos.permission.GRYOSCOPE ,该权限为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -213,6 +220,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: AsyncCal ...@@ -213,6 +220,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: AsyncCal
监听大幅动作传感器数据变化。如果多次调用该接口,仅最后一次调用生效。 监听大幅动作传感器数据变化。如果多次调用该接口,仅最后一次调用生效。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -236,15 +245,19 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: AsyncCal ...@@ -236,15 +245,19 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: AsyncCal
## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION) ## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION)
on(type: sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: AsyncCallback&lt;PedometerDetectResponse&gt;, options?: Options): void on(type: sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: AsyncCallback&lt;PedometerDetectionResponse&gt;, options?: Options): void
监听计步检测传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听计步检测传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**需要权限**:ohos.permission.ACTIVITY_MOTION ,该权限为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | 是 | 要订阅的计步检测传感器类型为SENSOR_TYPE_ID_PEDOMETER_DETECTION。 | | type | [SensorType](#sensortype) | 是 | 要订阅的计步检测传感器类型为SENSOR_TYPE_ID_PEDOMETER_DETECTION。 |
| callback | AsyncCallback&lt;[PedometerDetectResponse](#pedometerdetectresponse)&gt; | 是 | 注册计步检测传感器的回调函数,上报的数据类型为PedometerDetectResponse。 | | callback | AsyncCallback&lt;[PedometerDetectionResponse](#pedometerdetectionresponse)&gt; | 是 | 注册计步检测传感器的回调函数,上报的数据类型为PedometerDetectionResponse。 |
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
- 示例: - 示例:
...@@ -267,6 +280,10 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback&lt; ...@@ -267,6 +280,10 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback&lt;
监听计步传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听计步传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**需要权限**:ohos.permission.ACTIVITY_MOTION ,该权限为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -294,6 +311,8 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:AsyncCallb ...@@ -294,6 +311,8 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:AsyncCallb
监听环境温度传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听环境温度传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -321,6 +340,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallbac ...@@ -321,6 +340,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallbac
监听磁场传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听磁场传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -350,6 +371,8 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback:As ...@@ -350,6 +371,8 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback:As
监听未校准磁场传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听未校准磁场传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -382,6 +405,8 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback&lt;P ...@@ -382,6 +405,8 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback&lt;P
监听接近光传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听接近光传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -409,6 +434,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback&lt;H ...@@ -409,6 +434,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback&lt;H
监听湿度传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听湿度传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -436,6 +463,8 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback&lt;B ...@@ -436,6 +463,8 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback&lt;B
监听气压计传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听气压计传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -463,6 +492,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback&lt;HallR ...@@ -463,6 +492,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback&lt;HallR
监听霍尔传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听霍尔传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -490,6 +521,8 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallback& ...@@ -490,6 +521,8 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallback&
监听环境光传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听环境光传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -517,6 +550,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback&l ...@@ -517,6 +550,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback&l
监听方向传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听方向传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -546,6 +581,8 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,callback:AsyncCallback& ...@@ -546,6 +581,8 @@ on(type:sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,callback:AsyncCallback&
监听旋转矢量传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听旋转矢量传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -575,6 +612,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallbac ...@@ -575,6 +612,8 @@ on(type: sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallbac
监听佩戴检测传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。 监听佩戴检测传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -602,6 +641,10 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallba ...@@ -602,6 +641,10 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallba
监听加速度传感器的数据变化一次。 监听加速度传感器的数据变化一次。
**需要权限**:ohos.permission.ACCELEROMETER ,该权限为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -629,6 +672,10 @@ once(type:sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:AsyncCal ...@@ -629,6 +672,10 @@ once(type:sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:AsyncCal
监听线性加速度传感器数据变化一次。 监听线性加速度传感器数据变化一次。
**需要权限**:ohos.permission.ACCELEROMETER ,该权限为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -656,6 +703,10 @@ once(type:sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback:A ...@@ -656,6 +703,10 @@ once(type:sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback:A
监听未校准加速度传感器的数据变化一次。 监听未校准加速度传感器的数据变化一次。
**需要权限**:ohos.permission.ACCELEROMETER ,该权限为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -686,6 +737,8 @@ once(type:sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback&lt;G ...@@ -686,6 +737,8 @@ once(type:sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback&lt;G
监听重力传感器的数据变化一次。 监听重力传感器的数据变化一次。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -713,6 +766,10 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback&l ...@@ -713,6 +766,10 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback&l
监听陀螺仪传感器的数据变化一次。 监听陀螺仪传感器的数据变化一次。
**需要权限**:ohos.permission.GYROSCOPE ,该权限为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -740,6 +797,10 @@ once(type:sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:Async ...@@ -740,6 +797,10 @@ once(type:sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:Async
监听未校准陀螺仪传感器的数据变化一次。 监听未校准陀螺仪传感器的数据变化一次。
**需要权限**:ohos.permission.GYROSCOPE ,该权限为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -770,6 +831,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,callback:AsyncCal ...@@ -770,6 +831,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,callback:AsyncCal
监听有效运动传感器的数据变化一次。 监听有效运动传感器的数据变化一次。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -791,15 +854,19 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,callback:AsyncCal ...@@ -791,15 +854,19 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,callback:AsyncCal
## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION) ## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION)
once(type:sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,callback:AsyncCallback&lt;PedometerDetectResponse&gt;): void once(type:sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,callback:AsyncCallback&lt;PedometerDetectionResponse&gt;): void
监听计步检测传感器数据变化一次。 监听计步检测传感器数据变化一次。
**需要权限**:ohos.permission.ACTIVITY_MOTION, 该权为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | 是 | 计步检测传感器类型为SENSOR_TYPE_ID_PEDOMETER_DETECTION。 | | type | [SensorType](#sensortype) | 是 | 计步检测传感器类型为SENSOR_TYPE_ID_PEDOMETER_DETECTION。 |
| callback | AsyncCallback&lt;[PedometerDetectResponse](#pedometerdetectresponse)&gt; | 是 | 注册一次计步检测传感器的回调函数,上报的数据类型为PedometerDetectResponse。 | | callback | AsyncCallback&lt;[PedometerDetectionResponse](#pedometerdetectionresponse)&gt; | 是 | 注册一次计步检测传感器的回调函数,上报的数据类型为PedometerDetectionResponse。 |
- 示例: - 示例:
``` ```
...@@ -820,6 +887,10 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback&l ...@@ -820,6 +887,10 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback&l
监听计步器传感器数据变化一次。 监听计步器传感器数据变化一次。
**需要权限**:ohos.permission.ACTIVITY_MOTION, 该权为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -845,6 +916,8 @@ once(type:sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:AsyncCal ...@@ -845,6 +916,8 @@ once(type:sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:AsyncCal
监听环境温度传感器数据变化一次。 监听环境温度传感器数据变化一次。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -870,6 +943,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallb ...@@ -870,6 +943,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallb
监听磁场传感器数据变化一次。 监听磁场传感器数据变化一次。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -897,6 +972,8 @@ once(type:sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback: ...@@ -897,6 +972,8 @@ once(type:sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback:
监听未校准磁场传感器数据变化一次。 监听未校准磁场传感器数据变化一次。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -927,6 +1004,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback&l ...@@ -927,6 +1004,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback&l
监听接近光传感器数据变化一次。 监听接近光传感器数据变化一次。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -952,6 +1031,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback&lt ...@@ -952,6 +1031,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback&lt
监听湿度传感器数据变化一次。 监听湿度传感器数据变化一次。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -977,6 +1058,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback&l ...@@ -977,6 +1058,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback&l
监听气压计传感器数据变化一次。 监听气压计传感器数据变化一次。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1002,6 +1085,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback&lt;H ...@@ -1002,6 +1085,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback&lt;H
监听霍尔传感器数据变化一次。 监听霍尔传感器数据变化一次。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1027,6 +1112,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallba ...@@ -1027,6 +1112,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallba
监听环境光传感器数据变化一次。 监听环境光传感器数据变化一次。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1052,6 +1139,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback ...@@ -1052,6 +1139,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback
监听方向传感器数据变化一次。 监听方向传感器数据变化一次。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1079,6 +1168,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: AsyncCall ...@@ -1079,6 +1168,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: AsyncCall
监听旋转矢量传感器数据变化一次。 监听旋转矢量传感器数据变化一次。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1106,6 +1197,10 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: AsyncCallback& ...@@ -1106,6 +1197,10 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: AsyncCallback&
监听心率传感器数据变化一次。 监听心率传感器数据变化一次。
**需要权限**:ohos.permission.HEART_RATE ,该权限为系统权限
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1131,6 +1226,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallb ...@@ -1131,6 +1226,8 @@ once(type: sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallb
监听佩戴检测传感器数据变化一次。 监听佩戴检测传感器数据变化一次。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1156,6 +1253,8 @@ off(type: SensorType, callback?: AsyncCallback&lt;void&gt;): void ...@@ -1156,6 +1253,8 @@ off(type: SensorType, callback?: AsyncCallback&lt;void&gt;): void
取消订阅传感器数据。 取消订阅传感器数据。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1180,6 +1279,8 @@ transformCoordinateSystem(inRotationVector: Array&lt;number&gt;, coordinates: Co ...@@ -1180,6 +1279,8 @@ transformCoordinateSystem(inRotationVector: Array&lt;number&gt;, coordinates: Co
旋转提供的旋转矩阵,使其可以以不同的方式表示坐标系。 旋转提供的旋转矩阵,使其可以以不同的方式表示坐标系。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1209,6 +1310,8 @@ transformCoordinateSystem(inRotationVector: Array&lt;number&gt;, coordinates: Co ...@@ -1209,6 +1310,8 @@ transformCoordinateSystem(inRotationVector: Array&lt;number&gt;, coordinates: Co
旋转提供的旋转矩阵,使其可以以不同的方式表示坐标系。 旋转提供的旋转矩阵,使其可以以不同的方式表示坐标系。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1245,6 +1348,8 @@ getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callba ...@@ -1245,6 +1348,8 @@ getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callba
获取地球上特定位置的地磁场。 获取地球上特定位置的地磁场。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1272,6 +1377,8 @@ getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promi ...@@ -1272,6 +1377,8 @@ getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promi
获取地球上特定位置的地磁场。 获取地球上特定位置的地磁场。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1301,6 +1408,8 @@ getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallbac ...@@ -1301,6 +1408,8 @@ getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallbac
根据气压值获取设备所在的海拔高度。 根据气压值获取设备所在的海拔高度。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1328,6 +1437,8 @@ getAltitude(seaPressure: number, currentPressure: number): Promise&lt;number&gt; ...@@ -1328,6 +1437,8 @@ getAltitude(seaPressure: number, currentPressure: number): Promise&lt;number&gt;
根据气压值获取设备所在的海拔高度。 根据气压值获取设备所在的海拔高度。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1359,6 +1470,8 @@ getGeomagneticDip(inclinationMatrix: Array&lt;number&gt;, callback: AsyncCallbac ...@@ -1359,6 +1470,8 @@ getGeomagneticDip(inclinationMatrix: Array&lt;number&gt;, callback: AsyncCallbac
根据倾斜矩阵计算地磁倾斜角。 根据倾斜矩阵计算地磁倾斜角。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1385,6 +1498,8 @@ getGeomagneticDip(inclinationMatrix: Array&lt;number&gt;): Promise&lt;number&gt; ...@@ -1385,6 +1498,8 @@ getGeomagneticDip(inclinationMatrix: Array&lt;number&gt;): Promise&lt;number&gt;
根据倾斜矩阵计算地磁倾斜角。 根据倾斜矩阵计算地磁倾斜角。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1414,6 +1529,8 @@ getAngleModify(currentRotationMatrix: Array&lt;number&gt;, preRotationMatrix: Ar ...@@ -1414,6 +1529,8 @@ getAngleModify(currentRotationMatrix: Array&lt;number&gt;, preRotationMatrix: Ar
获取两个旋转矩阵之间的角度变化。 获取两个旋转矩阵之间的角度变化。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1445,6 +1562,8 @@ getAngleModify(currentRotationMatrix: Array&lt;number&gt;, preRotationMatrix: Ar ...@@ -1445,6 +1562,8 @@ getAngleModify(currentRotationMatrix: Array&lt;number&gt;, preRotationMatrix: Ar
获取两个旋转矩阵之间的角度变化。 获取两个旋转矩阵之间的角度变化。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1479,6 +1598,8 @@ createRotationMatrix(rotationVector: Array&lt;number&gt;, callback: AsyncCallbac ...@@ -1479,6 +1598,8 @@ createRotationMatrix(rotationVector: Array&lt;number&gt;, callback: AsyncCallbac
将旋转矢量转换为旋转矩阵。 将旋转矢量转换为旋转矩阵。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1509,6 +1630,8 @@ createRotationMatrix(rotationVector: Array&lt;number&gt;): Promise&lt;Array&lt;n ...@@ -1509,6 +1630,8 @@ createRotationMatrix(rotationVector: Array&lt;number&gt;): Promise&lt;Array&lt;n
将旋转矢量转换为旋转矩阵。 将旋转矢量转换为旋转矩阵。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1542,6 +1665,8 @@ createQuaternion(rotationVector: Array&lt;number&gt;, callback: AsyncCallback&lt ...@@ -1542,6 +1665,8 @@ createQuaternion(rotationVector: Array&lt;number&gt;, callback: AsyncCallback&lt
将旋转矢量转换为四元数。 将旋转矢量转换为四元数。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1572,6 +1697,8 @@ createQuaternion(rotationVector: Array&lt;number&gt;): Promise&lt;Array&lt;numbe ...@@ -1572,6 +1697,8 @@ createQuaternion(rotationVector: Array&lt;number&gt;): Promise&lt;Array&lt;numbe
将旋转矢量转换为四元数。 将旋转矢量转换为四元数。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1605,6 +1732,8 @@ getDirection(rotationMatrix: Array&lt;number&gt;, callback: AsyncCallback&lt;Arr ...@@ -1605,6 +1732,8 @@ getDirection(rotationMatrix: Array&lt;number&gt;, callback: AsyncCallback&lt;Arr
根据旋转矩阵计算设备的方向。 根据旋转矩阵计算设备的方向。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1635,6 +1764,8 @@ getDirection(rotationMatrix: Array&lt;number&gt;): Promise&lt;Array&lt;number&gt ...@@ -1635,6 +1764,8 @@ getDirection(rotationMatrix: Array&lt;number&gt;): Promise&lt;Array&lt;number&gt
根据旋转矩阵计算设备的方向。 根据旋转矩阵计算设备的方向。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1668,6 +1799,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1668,6 +1799,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
根据重力矢量和地磁矢量计算旋转矩阵。 根据重力矢量和地磁矢量计算旋转矩阵。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1699,6 +1832,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1699,6 +1832,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
根据重力矢量和地磁矢量计算旋转矩阵。 根据重力矢量和地磁矢量计算旋转矩阵。
**系统能力**:SystemCapability.Sensors.Sensor
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -1731,6 +1866,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1731,6 +1866,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
表示要订阅或取消订阅的传感器类型。 表示要订阅或取消订阅的传感器类型。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 默认值 | 说明 | | 名称 | 默认值 | 说明 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
...@@ -1761,6 +1898,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1761,6 +1898,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
传感器数据的时间戳。 传感器数据的时间戳。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| timestamp | number | 是 | 是 | 传感器数据上报的时间戳。 | | timestamp | number | 是 | 是 | 传感器数据上报的时间戳。 |
...@@ -1770,6 +1909,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1770,6 +1909,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
加速度传感器数据,继承于[Response](#response) 加速度传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1782,6 +1923,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1782,6 +1923,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
线性加速度传感器数据,继承于[Response](#response) 线性加速度传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1794,6 +1937,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1794,6 +1937,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
未校准加速度计传感器数据,继承于[Response](#response) 未校准加速度计传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1809,6 +1954,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1809,6 +1954,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
重力传感器数据,继承于[Response](#response) 重力传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1821,6 +1968,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1821,6 +1968,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
方向传感器数据,继承于[Response](#response) 方向传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1833,6 +1982,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1833,6 +1982,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
旋转矢量传感器数据,继承于[Response](#response) 旋转矢量传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1845,6 +1996,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1845,6 +1996,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
陀螺仪传感器数据,继承于[Response](#response) 陀螺仪传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1857,6 +2010,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1857,6 +2010,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
未校准陀螺仪传感器数据,继承于[Response](#response) 未校准陀螺仪传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1872,6 +2027,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1872,6 +2027,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
有效运动传感器数据,继承于[Response](#response) 有效运动传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1882,6 +2039,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1882,6 +2039,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
接近光传感器数据,继承于[Response](#response) 接近光传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1892,6 +2051,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1892,6 +2051,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
环境光传感器数据,继承于[Response](#response) 环境光传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1902,6 +2063,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1902,6 +2063,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
霍尔传感器数据,继承于[Response](#response) 霍尔传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1912,6 +2075,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1912,6 +2075,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
磁场传感器数据,继承于[Response](#response) 磁场传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1924,6 +2089,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1924,6 +2089,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
未校准磁场传感器数据,继承于[Response](#response) 未校准磁场传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1939,6 +2106,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1939,6 +2106,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
计步传感器数据,继承于[Response](#response) 计步传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1949,16 +2118,20 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1949,16 +2118,20 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
湿度传感器数据,继承于[Response](#response) 湿度传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| humidity | number | 是 | 是 | 湿度值。测量环境的相对湿度,以百分比&nbsp;(%)&nbsp;表示。 | | humidity | number | 是 | 是 | 湿度值。测量环境的相对湿度,以百分比&nbsp;(%)&nbsp;表示。 |
## PedometerDetectResponse ## PedometerDetectionResponse
计步检测传感器数据,继承于[Response](#response) 计步检测传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1969,6 +2142,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1969,6 +2142,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
温度传感器数据,继承于[Response](#response) 温度传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1979,6 +2154,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1979,6 +2154,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
气压计传感器数据,继承于[Response](#response) 气压计传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1989,6 +2166,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1989,6 +2166,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
心率传感器数据,继承于[Response](#response) 心率传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -1999,6 +2178,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -1999,6 +2178,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
佩戴检测传感器数据,继承于[Response](#response) 佩戴检测传感器数据,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -2009,13 +2190,17 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -2009,13 +2190,17 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
设置传感器上报频率。 设置传感器上报频率。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 说明 | | 名称 | 参数类型 | 说明 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| interval | number | 表示传感器的上报频率,默认值为200000000ns。 | | interval | number | 表示传感器的上报频率,默认值为200000000ns。 |
## RotationMatrixResponse ## RotationMatrixResponse
设置旋转矩阵响应对象 设置旋转矩阵响应对象。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| ----------- | ------------------- | ---- | ---- | ---------- | | ----------- | ------------------- | ---- | ---- | ---------- |
...@@ -2025,7 +2210,9 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -2025,7 +2210,9 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
## CoordinatesOptions ## CoordinatesOptions
设置坐标选项对象 设置坐标选项对象。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| ---- | -------- | ---- | ---- | ----------- | | ---- | -------- | ---- | ---- | ----------- |
...@@ -2037,6 +2224,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -2037,6 +2224,8 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
设置地磁响应对象,继承于[Response](#response) 设置地磁响应对象,继承于[Response](#response)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| x | number | 是 | 是 | 地磁场的北分量。 | | x | number | 是 | 是 | 地磁场的北分量。 |
...@@ -2047,9 +2236,12 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -2047,9 +2236,12 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
| levelIntensity | number | 是 | 是 | 地磁场的水平强度。 | | levelIntensity | number | 是 | 是 | 地磁场的水平强度。 |
| totalIntensity | number | 是 | 是 | 地磁场的总强度。 | | totalIntensity | number | 是 | 是 | 地磁场的总强度。 |
## LocationOptions ## LocationOptions
指示地理位置。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| latitude | number | 是 | 是 | 纬度。 | | latitude | number | 是 | 是 | 纬度。 |
......
...@@ -10,22 +10,17 @@ ...@@ -10,22 +10,17 @@
import vibrator from '@ohos.vibrator'; import vibrator from '@ohos.vibrator';
``` ```
## 系统能力
SystemCapability.Sensors.MiscDevice
## 权限列表
ohos.permission.VIBRATE
## vibrator.vibrate ## vibrator.vibrate
vibrate(duration: number): Promise&lt;void&gt; vibrate(duration: number): Promise&lt;void&gt;
按照指定持续时间触发马达振动。 按照指定持续时间触发马达振动。
**权限列表**:ohos.permission.VIBRATE
**系统能力**:SystemCapability.Sensors.MiscDevice
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -54,13 +49,17 @@ vibrate(duration: number, callback?: AsyncCallback&lt;void&gt;): void ...@@ -54,13 +49,17 @@ vibrate(duration: number, callback?: AsyncCallback&lt;void&gt;): void
按照指定持续时间触发马达振动。 按照指定持续时间触发马达振动。
**权限列表**:ohos.permission.VIBRATE
**系统能力**:SystemCapability.Sensors.MiscDevice
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| duration | number | 是 | 指示马达振动的持续时间。 | | duration | number | 是 | 指示马达振动的持续时间。 |
| callback | AsyncCallback&lt;void&gt; | 否 | 马达执行振动的回调函数,指示触发振动是否成功。 | | callback | AsyncCallback&lt;void&gt; | 否 | 马达执行振动的回调函数,指示触发振动是否成功。 |
- 示例**:** - 示例
``` ```
vibrator.vibrate(1000,function(error){ vibrator.vibrate(1000,function(error){
if(error){ if(error){
...@@ -78,6 +77,10 @@ vibrate(effectId: EffectId): Promise&lt;void&gt; ...@@ -78,6 +77,10 @@ vibrate(effectId: EffectId): Promise&lt;void&gt;
按照指定振动效果触发马达振动。 按照指定振动效果触发马达振动。
**权限列表**:ohos.permission.VIBRATE
**系统能力**:SystemCapability.Sensors.MiscDevice
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -104,6 +107,10 @@ vibrate(effectId: EffectId, callback?: AsyncCallback&lt;void&gt;): void ...@@ -104,6 +107,10 @@ vibrate(effectId: EffectId, callback?: AsyncCallback&lt;void&gt;): void
按照指定振动效果触发马达振动。 按照指定振动效果触发马达振动。
**权限列表**:ohos.permission.VIBRATE
**系统能力**:SystemCapability.Sensors.MiscDevice
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -128,6 +135,10 @@ stop(stopMode: VibratorStopMode): Promise&lt;void&gt; ...@@ -128,6 +135,10 @@ stop(stopMode: VibratorStopMode): Promise&lt;void&gt;
按照要停止指定的振动模式来停止马达的振动。如果要停止的振动模式与触发马达振动时的模式不相同,则调用本接口会失败。 按照要停止指定的振动模式来停止马达的振动。如果要停止的振动模式与触发马达振动时的模式不相同,则调用本接口会失败。
**权限列表**:ohos.permission.VIBRATE
**系统能力**:SystemCapability.Sensors.MiscDevice
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -154,6 +165,10 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback&lt;void&gt;): void; ...@@ -154,6 +165,10 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback&lt;void&gt;): void;
按照要停止指定的振动模式来停止马达的振动。如果要停止的振动模式与触发马达振动时的模式不相同,则调用本接口会失败。 按照要停止指定的振动模式来停止马达的振动。如果要停止的振动模式与触发马达振动时的模式不相同,则调用本接口会失败。
**权限列表**:ohos.permission.VIBRATE
**系统能力**:SystemCapability.Sensors.MiscDevice
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -176,6 +191,8 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback&lt;void&gt;): void; ...@@ -176,6 +191,8 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback&lt;void&gt;): void;
表示马达振动效果的字符串。 表示马达振动效果的字符串。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.MiscDevice
| 名称 | 默认值 | 说明 | | 名称 | 默认值 | 说明 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| EFFECT_CLOCK_TIMER | "haptic.clock.timer" | 调整定时器时振动器的振动效果。 | | EFFECT_CLOCK_TIMER | "haptic.clock.timer" | 调整定时器时振动器的振动效果。 |
...@@ -185,6 +202,8 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback&lt;void&gt;): void; ...@@ -185,6 +202,8 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback&lt;void&gt;): void;
表示马达要停止指定的振动模式。 表示马达要停止指定的振动模式。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.MiscDevice
| 名称 | 默认值 | 说明 | | 名称 | 默认值 | 说明 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| VIBRATOR_STOP_MODE_TIME | "time" | 停止模式为duration模式的振动。即触发振动时参数类型为number,参数本身为指示振动持续时间的触发方式。 | | VIBRATOR_STOP_MODE_TIME | "time" | 停止模式为duration模式的振动。即触发振动时参数类型为number,参数本身为指示振动持续时间的触发方式。 |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册