@@ -15,65 +15,64 @@ For details about the APIs, see [Sensor](../reference/apis/js-apis-sensor.md).
...
@@ -15,65 +15,64 @@ For details about the APIs, see [Sensor](../reference/apis/js-apis-sensor.md).
| ohos.sensor | sensor.on(sensorId, callback:AsyncCallback<Response>): void | Subscribes to data changes of a type of sensor.|
| ohos.sensor | sensor.on(sensorId, callback:AsyncCallback<Response>): void | Subscribes to data changes of a type of sensor.|
| ohos.sensor | sensor.once(sensorId, callback:AsyncCallback<Response>): void | Subscribes to only one data change of a type of sensor.|
| ohos.sensor | sensor.once(sensorId, callback:AsyncCallback<Response>): void | Subscribes to only one data change of a type of sensor.|
| ohos.sensor | sensor.off(sensorId, callback?:AsyncCallback<void>): void | Unsubscribes from sensor data changes.|
| ohos.sensor | sensor.off(sensorId, callback?:AsyncCallback<void>): void | Unsubscribes from sensor data changes.|
| ohos.sensor | sensor.getSensorList(callback: AsyncCallback\<Array\<Sensor>>): void| Obtains information about all sensors on the device. This API uses an asynchronous callback to return the result.|
## How to Develop
## How to Develop
1. Before obtaining data from a type of sensor, check whether the required permission has been configured.<br>
The acceleration sensor is used as an example.
The system provides the following sensor-related permissions:
- ohos.permission.ACCELEROMETER
- ohos.permission.GYROSCOPE
1. Import the module.
- ohos.permission.ACTIVITY_MOTION
- ohos.permission.READ_HEALTH_DATA
For details about how to configure a permission, see [Declaring Permissions](../security/accesstoken-guidelines.md).
2. Subscribe to data changes of a type of sensor. The following uses the acceleration sensor as an example.
The minimum and the maximum sampling periods supported by the sensor are 5000000 ns and 200000000 ns, respectively. Therefore, the value of **interval** must be within this range.
3. Check whether the corresponding permission has been configured. For details, see [Applying for Permissions](../security/accesstoken-guidelines.md).
3. Unsubscribe from sensor data changes.
4. Register a listener. You can call **on()** or **once()** to listen for sensor data changes.
- The **on()** API is used to continuously listen for data changes of the sensor. The sensor reporting interval is set to 100000000 ns.
```ts
```ts
importsensorfrom"@ohos.sensor";
sensor.on(sensor.SensorId.ACCELEROMETER, function (data) {
@@ -76,9 +76,9 @@ This JSON file contains two attributes: **MetaData** and **Channels**.
...
@@ -76,9 +76,9 @@ This JSON file contains two attributes: **MetaData** and **Channels**.
-**Create**: time when the file was created. This parameter is optional.
-**Create**: time when the file was created. This parameter is optional.
-**Description**: additional information such as the vibration effect and creation information. This parameter is optional.
-**Description**: additional information such as the vibration effect and creation information. This parameter is optional.
-**Channels** provides information about the vibration channel. It is a JSON array that holds information about each channel. It contains two attributes: **Parameters** and **Pattern**.
-**Channels** provides information about the vibration channel. It is a JSON array that holds information about each channel. It contains two attributes: **Parameters** and **Pattern**.
-**Parameters** provides parameters related to the channel. Under it, **Index** indicates the channel ID. The value is fixed at **1** for a single channel. This parameter is mandatory.
-**Parameters** provides parameters related to the channel. Under it, **Index** indicates the channel ID. The value is fixed at **1** for a single channel. This parameter is mandatory.
-**Pattern** indicates the vibration sequence. It is a JSON array. Under it, **Event** indicates a vibration event, which can be either of the following types:
-**Pattern** indicates the vibration sequence. It is a JSON array. Under it, **Event** indicates a vibration event, which can be either of the following types:
-**transient**: short vibration
-**transient**: short vibration
-**continuous**: long vibration
-**continuous**: long vibration
The table below describes the parameters under **Event**.
The table below describes the parameters under **Event**.
...
@@ -89,7 +89,7 @@ The table below describes the parameters under **Event**.
...
@@ -89,7 +89,7 @@ The table below describes the parameters under **Event**.
| StartTime | Start time of the vibration. This parameter is mandatory.| [0, 1800 000], in ms, without overlapping|
| StartTime | Start time of the vibration. This parameter is mandatory.| [0, 1800 000], in ms, without overlapping|
| Duration | Duration of the vibration. This parameter is valid only when **Type** is **continuous**.| (10, 1600), in ms|
| Duration | Duration of the vibration. This parameter is valid only when **Type** is **continuous**.| (10, 1600), in ms|
| Intensity | Intensity of the vibration. This parameter is mandatory.| [0, 100], a relative value that does not represent the actual vibration strength.|
| Intensity | Intensity of the vibration. This parameter is mandatory.| [0, 100], a relative value that does not represent the actual vibration strength.|
| Frequency | Frequency of the vibration. This parameter is mandatory.| [0, 100], a relative value that does not represent the actual vibration frequency|
| Frequency | Frequency of the vibration. This parameter is mandatory.| [0, 100], a relative value that does not represent the actual vibration frequency.|
The following requirements must be met:
The following requirements must be met:
...
@@ -221,22 +221,24 @@ The following requirements must be met:
...
@@ -221,22 +221,24 @@ The following requirements must be met:
```ts
```ts
importvibratorfrom'@ohos.vibrator';
importvibratorfrom'@ohos.vibrator';
constFILE_NAME="xxx.json";
// Obtain the file descriptor of the vibration configuration file.
// Obtain the file descriptor of the vibration configuration file.
@@ -24,7 +24,7 @@ Subscribes to data of the color sensor.
...
@@ -24,7 +24,7 @@ Subscribes to data of the color sensor.
**System API**: This is a system API.
**System API**: This is a system API.
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -63,7 +63,7 @@ Subscribes to data of the Sodium Adsorption Ratio (SAR) sensor.
...
@@ -63,7 +63,7 @@ Subscribes to data of the Sodium Adsorption Ratio (SAR) sensor.
**System API**: This is a system API.
**System API**: This is a system API.
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -109,7 +109,7 @@ Subscribes to data of the acceleration sensor.
...
@@ -109,7 +109,7 @@ Subscribes to data of the acceleration sensor.
| callback | Callback<[AccelerometerResponse](#accelerometerresponse)> | Yes | Callback used to report the sensor data, which is an **AccelerometerResponse** object.|
| callback | Callback<[AccelerometerResponse](#accelerometerresponse)> | Yes | Callback used to report the sensor data, which is an **AccelerometerResponse** object.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -149,7 +149,7 @@ Subscribes to data of the uncalibrated acceleration sensor.
...
@@ -149,7 +149,7 @@ Subscribes to data of the uncalibrated acceleration sensor.
| callback | Callback<[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)> | Yes | Callback used to report the sensor data, which is an **AccelerometerUncalibratedResponse** object.|
| callback | Callback<[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)> | Yes | Callback used to report the sensor data, which is an **AccelerometerUncalibratedResponse** object.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -190,7 +190,7 @@ Subscribes to data of the ambient light sensor.
...
@@ -190,7 +190,7 @@ Subscribes to data of the ambient light sensor.
| callback | Callback<[LightResponse](#lightresponse)> | Yes | Callback used to report the sensor data, which is a **LightResponse** object. |
| callback | Callback<[LightResponse](#lightresponse)> | Yes | Callback used to report the sensor data, which is a **LightResponse** object. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -226,7 +226,7 @@ Subscribes to data of the ambient temperature sensor.
...
@@ -226,7 +226,7 @@ Subscribes to data of the ambient temperature sensor.
| callback | Callback<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | Yes | Callback used to report the sensor data, which is an **AmbientTemperatureResponse** object.|
| callback | Callback<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | Yes | Callback used to report the sensor data, which is an **AmbientTemperatureResponse** object.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -262,7 +262,7 @@ Subscribes to data of the barometer sensor.
...
@@ -262,7 +262,7 @@ Subscribes to data of the barometer sensor.
| callback | Callback<[BarometerResponse](#barometerresponse)> | Yes | Callback used to report the sensor data, which is a **BarometerResponse** object. |
| callback | Callback<[BarometerResponse](#barometerresponse)> | Yes | Callback used to report the sensor data, which is a **BarometerResponse** object. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -298,7 +298,7 @@ Subscribes to data of the gravity sensor.
...
@@ -298,7 +298,7 @@ Subscribes to data of the gravity sensor.
| callback | Callback<[GravityResponse](#gravityresponse)> | Yes | Callback used to report the sensor data, which is a **GravityResponse** object. |
| callback | Callback<[GravityResponse](#gravityresponse)> | Yes | Callback used to report the sensor data, which is a **GravityResponse** object. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -338,7 +338,7 @@ Subscribes to data of the gyroscope sensor.
...
@@ -338,7 +338,7 @@ Subscribes to data of the gyroscope sensor.
| callback | Callback<[GyroscopeResponse](#gyroscoperesponse)> | Yes | Callback used to report the sensor data, which is a **GyroscopeResponse** object. |
| callback | Callback<[GyroscopeResponse](#gyroscoperesponse)> | Yes | Callback used to report the sensor data, which is a **GyroscopeResponse** object. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -379,7 +379,7 @@ Subscribes to data of the uncalibrated gyroscope sensor.
...
@@ -379,7 +379,7 @@ Subscribes to data of the uncalibrated gyroscope sensor.
| callback | Callback<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | Yes | Callback used to report the sensor data, which is a **GyroscopeUncalibratedResponse** object.|
| callback | Callback<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | Yes | Callback used to report the sensor data, which is a **GyroscopeUncalibratedResponse** object.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -420,7 +420,7 @@ Subscribes to data of the Hall effect sensor.
...
@@ -420,7 +420,7 @@ Subscribes to data of the Hall effect sensor.
| callback | Callback<[HallResponse](#hallresponse)> | Yes | Callback used to report the sensor data, which is a **HallResponse** object. |
| callback | Callback<[HallResponse](#hallresponse)> | Yes | Callback used to report the sensor data, which is a **HallResponse** object. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -458,7 +458,7 @@ Subscribes to data of the heart rate sensor.
...
@@ -458,7 +458,7 @@ Subscribes to data of the heart rate sensor.
| callback | Callback<[HeartRateResponse](#heartrateresponse)> | Yes | Callback used to report the sensor data, which is a **HeartRateResponse** object. |
| callback | Callback<[HeartRateResponse](#heartrateresponse)> | Yes | Callback used to report the sensor data, which is a **HeartRateResponse** object. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -494,7 +494,7 @@ Subscribes to data of the humidity sensor.
...
@@ -494,7 +494,7 @@ Subscribes to data of the humidity sensor.
| callback | Callback<[HumidityResponse](#humidityresponse)> | Yes | Callback used to report the sensor data, which is a **HumidityResponse** object. |
| callback | Callback<[HumidityResponse](#humidityresponse)> | Yes | Callback used to report the sensor data, which is a **HumidityResponse** object. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -533,7 +533,7 @@ Subscribes to data of the linear acceleration sensor.
...
@@ -533,7 +533,7 @@ Subscribes to data of the linear acceleration sensor.
| callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | Yes | Callback used to report the sensor data, which is a **LinearAccelerometerResponse** object.|
| callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | Yes | Callback used to report the sensor data, which is a **LinearAccelerometerResponse** object.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -571,7 +571,7 @@ Subscribes to data of the magnetic field sensor.
...
@@ -571,7 +571,7 @@ Subscribes to data of the magnetic field sensor.
| callback | Callback<[MagneticFieldResponse](#magneticfieldresponse)> | Yes | Callback used to report the sensor data, which is a **MagneticFieldResponse** object.|
| callback | Callback<[MagneticFieldResponse](#magneticfieldresponse)> | Yes | Callback used to report the sensor data, which is a **MagneticFieldResponse** object.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -609,7 +609,7 @@ Subscribes to data of the uncalibrated magnetic field sensor.
...
@@ -609,7 +609,7 @@ Subscribes to data of the uncalibrated magnetic field sensor.
| callback | Callback<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | Yes | Callback used to report the sensor data, which is a **MagneticFieldUncalibratedResponse** object.|
| callback | Callback<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | Yes | Callback used to report the sensor data, which is a **MagneticFieldUncalibratedResponse** object.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -642,7 +642,7 @@ Subscribes to data of the orientation sensor.
...
@@ -642,7 +642,7 @@ Subscribes to data of the orientation sensor.
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -729,7 +729,7 @@ Subscribes to data of the pedometer detection sensor.
...
@@ -729,7 +729,7 @@ Subscribes to data of the pedometer detection sensor.
| callback | Callback<[PedometerDetectionResponse](#pedometerdetectionresponse)> | Yes | Callback used to report the sensor data, which is a **PedometerDetectionResponse** object.|
| callback | Callback<[PedometerDetectionResponse](#pedometerdetectionresponse)> | Yes | Callback used to report the sensor data, which is a **PedometerDetectionResponse** object.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -765,7 +765,7 @@ Subscribes to data of the proximity sensor.
...
@@ -765,7 +765,7 @@ Subscribes to data of the proximity sensor.
| callback | Callback<[ProximityResponse](#proximityresponse)> | Yes | Callback used to report the sensor data, which is a **ProximityResponse** object. |
| callback | Callback<[ProximityResponse](#proximityresponse)> | Yes | Callback used to report the sensor data, which is a **ProximityResponse** object. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -802,7 +802,7 @@ Subscribes to data of the rotation vector sensor.
...
@@ -802,7 +802,7 @@ Subscribes to data of the rotation vector sensor.
| callback | Callback<[RotationVectorResponse](#rotationvectorresponse)> | Yes | Callback used to report the sensor data, which is a **RotationVectorResponse** object.|
| callback | Callback<[RotationVectorResponse](#rotationvectorresponse)> | Yes | Callback used to report the sensor data, which is a **RotationVectorResponse** object.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -842,7 +842,7 @@ Subscribes to data of the significant motion sensor.
...
@@ -842,7 +842,7 @@ Subscribes to data of the significant motion sensor.
| callback | Callback<[SignificantMotionResponse](#significantmotionresponse)> | Yes | Callback used to report the sensor data, which is a **SignificantMotionResponse** object.|
| callback | Callback<[SignificantMotionResponse](#significantmotionresponse)> | Yes | Callback used to report the sensor data, which is a **SignificantMotionResponse** object.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns. |
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -879,7 +879,7 @@ Subscribes to data of the wear detection sensor.
...
@@ -879,7 +879,7 @@ Subscribes to data of the wear detection sensor.
| callback | Callback<[WearDetectionResponse](#weardetectionresponse)> | Yes | Callback used to report the sensor data, which is a **WearDetectionResponse** object.|
| callback | Callback<[WearDetectionResponse](#weardetectionresponse)> | Yes | Callback used to report the sensor data, which is a **WearDetectionResponse** object.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
| options | [Options](#options) | No | List of optional parameters. This parameter is used to set the data reporting frequency. The default value is 200,000,000 ns.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -918,7 +918,7 @@ Obtains data of the acceleration sensor once.
...
@@ -918,7 +918,7 @@ Obtains data of the acceleration sensor once.
| type | [SensorId](#sensorid9).ACCELEROMETER | Yes | Sensor type. The value is fixed at **SensorId.ACCELEROMETER**. |
| type | [SensorId](#sensorid9).ACCELEROMETER | Yes | Sensor type. The value is fixed at **SensorId.ACCELEROMETER**. |
| callback | Callback<[AccelerometerResponse](#accelerometerresponse)> | Yes | Callback used to report the sensor data, which is an **AccelerometerResponse** object.|
| callback | Callback<[AccelerometerResponse](#accelerometerresponse)> | Yes | Callback used to report the sensor data, which is an **AccelerometerResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -957,7 +957,7 @@ Obtains data of the uncalibrated acceleration sensor once.
...
@@ -957,7 +957,7 @@ Obtains data of the uncalibrated acceleration sensor once.
| type | [SensorId](#sensorid9).ACCELEROMETER_UNCALIBRATED | Yes | Sensor type. The value is fixed at **SensorId.ACCELEROMETER_UNCALIBRATED**. |
| type | [SensorId](#sensorid9).ACCELEROMETER_UNCALIBRATED | Yes | Sensor type. The value is fixed at **SensorId.ACCELEROMETER_UNCALIBRATED**. |
| callback | Callback<[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)> | Yes | Callback used to report the sensor data, which is an **AccelerometerUncalibratedResponse** object.|
| callback | Callback<[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)> | Yes | Callback used to report the sensor data, which is an **AccelerometerUncalibratedResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -997,7 +997,7 @@ Obtains data of the ambient light sensor once.
...
@@ -997,7 +997,7 @@ Obtains data of the ambient light sensor once.
| type | [SensorId](#sensorid9).AMBIENT_LIGHT | Yes | Sensor type. The value is fixed at **SensorId.AMBIENT_LIGHT**. |
| type | [SensorId](#sensorid9).AMBIENT_LIGHT | Yes | Sensor type. The value is fixed at **SensorId.AMBIENT_LIGHT**. |
| callback | Callback<[LightResponse](#lightresponse)> | Yes | Callback used to report the sensor data, which is a **LightResponse** object.|
| callback | Callback<[LightResponse](#lightresponse)> | Yes | Callback used to report the sensor data, which is a **LightResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1032,7 +1032,7 @@ Obtains data of the temperature sensor once.
...
@@ -1032,7 +1032,7 @@ Obtains data of the temperature sensor once.
| type | [SensorId](#sensorid9).AMBIENT_TEMPERATURE | Yes | Sensor type. The value is fixed at **SensorId.AMBIENT_TEMPERATURE**. |
| type | [SensorId](#sensorid9).AMBIENT_TEMPERATURE | Yes | Sensor type. The value is fixed at **SensorId.AMBIENT_TEMPERATURE**. |
| callback | Callback<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | Yes | Callback used to report the sensor data, which is an **AmbientTemperatureResponse** object.|
| callback | Callback<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | Yes | Callback used to report the sensor data, which is an **AmbientTemperatureResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1067,7 +1067,7 @@ Obtains data of the barometer sensor once.
...
@@ -1067,7 +1067,7 @@ Obtains data of the barometer sensor once.
| type | [SensorId](#sensorid9).BAROMETER | Yes | Sensor type. The value is fixed at **SensorId.BAROMETER**. |
| type | [SensorId](#sensorid9).BAROMETER | Yes | Sensor type. The value is fixed at **SensorId.BAROMETER**. |
| callback | Callback<[BarometerResponse](#barometerresponse)> | Yes | Callback used to report the sensor data, which is a **BarometerResponse** object.|
| callback | Callback<[BarometerResponse](#barometerresponse)> | Yes | Callback used to report the sensor data, which is a **BarometerResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1102,7 +1102,7 @@ Obtains data of the gravity sensor once.
...
@@ -1102,7 +1102,7 @@ Obtains data of the gravity sensor once.
| type | [SensorId](#sensorid9).GRAVITY | Yes | Sensor type. The value is fixed at **SensorId.GRAVITY**. |
| type | [SensorId](#sensorid9).GRAVITY | Yes | Sensor type. The value is fixed at **SensorId.GRAVITY**. |
| callback | Callback<[GravityResponse](#gravityresponse)> | Yes | Callback used to report the sensor data, which is a **GravityResponse** object.|
| callback | Callback<[GravityResponse](#gravityresponse)> | Yes | Callback used to report the sensor data, which is a **GravityResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1141,7 +1141,7 @@ Obtains to data of the gyroscope sensor once.
...
@@ -1141,7 +1141,7 @@ Obtains to data of the gyroscope sensor once.
| type | [SensorId](#sensorid9).GYROSCOPE | Yes | Sensor type. The value is fixed at **SensorId.GYROSCOPE**. |
| type | [SensorId](#sensorid9).GYROSCOPE | Yes | Sensor type. The value is fixed at **SensorId.GYROSCOPE**. |
| callback | Callback<[GyroscopeResponse](#gyroscoperesponse)> | Yes | Callback used to report the sensor data, which is a **GyroscopeResponse** object.|
| callback | Callback<[GyroscopeResponse](#gyroscoperesponse)> | Yes | Callback used to report the sensor data, which is a **GyroscopeResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1182,7 +1182,7 @@ Obtains data of the uncalibrated gyroscope sensor once.
...
@@ -1182,7 +1182,7 @@ Obtains data of the uncalibrated gyroscope sensor once.
| type | [SensorId](#sensorid9).GYROSCOPE_UNCALIBRATED | Yes | Sensor type. The value is fixed at **SensorId.GYROSCOPE_UNCALIBRATED**. |
| type | [SensorId](#sensorid9).GYROSCOPE_UNCALIBRATED | Yes | Sensor type. The value is fixed at **SensorId.GYROSCOPE_UNCALIBRATED**. |
| callback | Callback<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | Yes | Callback used to report the sensor data, which is a **GyroscopeUncalibratedResponse** object.|
| callback | Callback<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | Yes | Callback used to report the sensor data, which is a **GyroscopeUncalibratedResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1222,7 +1222,7 @@ Obtains data of the Hall effect sensor once.
...
@@ -1222,7 +1222,7 @@ Obtains data of the Hall effect sensor once.
| type | [SensorId](#sensorid9).HALL | Yes | Sensor type. The value is fixed at **SensorId.HALL**. |
| type | [SensorId](#sensorid9).HALL | Yes | Sensor type. The value is fixed at **SensorId.HALL**. |
| callback | Callback<[HallResponse](#hallresponse)> | Yes | Callback used to report the sensor data, which is a **HallResponse** object.|
| callback | Callback<[HallResponse](#hallresponse)> | Yes | Callback used to report the sensor data, which is a **HallResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1259,7 +1259,7 @@ Obtains data of the heart rate sensor once.
...
@@ -1259,7 +1259,7 @@ Obtains data of the heart rate sensor once.
| type | [SensorId](#sensorid9).HEART_RATE | Yes | Sensor type. The value is fixed at **SensorId.HEART_RATE**. |
| type | [SensorId](#sensorid9).HEART_RATE | Yes | Sensor type. The value is fixed at **SensorId.HEART_RATE**. |
| callback | Callback<[HeartRateResponse](#heartrateresponse)> | Yes | Callback used to report the sensor data, which is a **HeartRateResponse** object.|
| callback | Callback<[HeartRateResponse](#heartrateresponse)> | Yes | Callback used to report the sensor data, which is a **HeartRateResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1294,7 +1294,7 @@ Obtains data of the humidity sensor once.
...
@@ -1294,7 +1294,7 @@ Obtains data of the humidity sensor once.
| type | [SensorId](#sensorid9).HUMIDITY | Yes | Sensor type. The value is fixed at **SensorId.HUMIDITY**. |
| type | [SensorId](#sensorid9).HUMIDITY | Yes | Sensor type. The value is fixed at **SensorId.HUMIDITY**. |
| callback | Callback<[HumidityResponse](#humidityresponse)> | Yes | Callback used to report the sensor data, which is a **HumidityResponse** object.|
| callback | Callback<[HumidityResponse](#humidityresponse)> | Yes | Callback used to report the sensor data, which is a **HumidityResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1331,7 +1331,7 @@ Obtains data of the linear acceleration sensor once.
...
@@ -1331,7 +1331,7 @@ Obtains data of the linear acceleration sensor once.
| type | [SensorId](#sensorid9).LINEAR_ACCELEROMETER | Yes | Sensor type. The value is fixed at **SensorId.LINEAR_ACCELEROMETER**. |
| type | [SensorId](#sensorid9).LINEAR_ACCELEROMETER | Yes | Sensor type. The value is fixed at **SensorId.LINEAR_ACCELEROMETER**. |
| callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | Yes | Callback used to report the sensor data, which is a **LinearAccelerometerResponse** object.|
| callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | Yes | Callback used to report the sensor data, which is a **LinearAccelerometerResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1368,7 +1368,7 @@ Obtains data of the magnetic field sensor once.
...
@@ -1368,7 +1368,7 @@ Obtains data of the magnetic field sensor once.
| type | [SensorId](#sensorid9).MAGNETIC_FIELD | Yes | Sensor type. The value is fixed at **SensorId.MAGNETIC_FIELD**. |
| type | [SensorId](#sensorid9).MAGNETIC_FIELD | Yes | Sensor type. The value is fixed at **SensorId.MAGNETIC_FIELD**. |
| callback | Callback<[MagneticFieldResponse](#magneticfieldresponse)> | Yes | Callback used to report the sensor data, which is a **MagneticFieldResponse** object.|
| callback | Callback<[MagneticFieldResponse](#magneticfieldresponse)> | Yes | Callback used to report the sensor data, which is a **MagneticFieldResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1405,7 +1405,7 @@ Obtains data of the uncalibrated magnetic field sensor once.
...
@@ -1405,7 +1405,7 @@ Obtains data of the uncalibrated magnetic field sensor once.
| type | [SensorId](#sensorid9).MAGNETIC_FIELD_UNCALIBRATED | Yes | Sensor type. The value is fixed at **SensorId.MAGNETIC_FIELD_UNCALIBRATED**.|
| type | [SensorId](#sensorid9).MAGNETIC_FIELD_UNCALIBRATED | Yes | Sensor type. The value is fixed at **SensorId.MAGNETIC_FIELD_UNCALIBRATED**.|
| callback | Callback<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | Yes | Callback used to report the sensor data, which is a **MagneticFieldUncalibratedResponse** object.|
| callback | Callback<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | Yes | Callback used to report the sensor data, which is a **MagneticFieldUncalibratedResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1445,7 +1445,7 @@ Obtains data of the orientation sensor once.
...
@@ -1445,7 +1445,7 @@ Obtains data of the orientation sensor once.
| type | [SensorId](#sensorid9).ORIENTATION | Yes | Sensor type. The value is fixed at **SensorId.ORIENTATION**. |
| type | [SensorId](#sensorid9).ORIENTATION | Yes | Sensor type. The value is fixed at **SensorId.ORIENTATION**. |
| callback | Callback<[OrientationResponse](#orientationresponse)> | Yes | Callback used to report the sensor data, which is a **OrientationResponse** object.|
| callback | Callback<[OrientationResponse](#orientationresponse)> | Yes | Callback used to report the sensor data, which is a **OrientationResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1484,7 +1484,7 @@ Obtains data of the pedometer sensor once.
...
@@ -1484,7 +1484,7 @@ Obtains data of the pedometer sensor once.
| type | [SensorId](#sensorid9).PEDOMETER | Yes | Sensor type. The value is fixed at **SensorId.PEDOMETER**. |
| type | [SensorId](#sensorid9).PEDOMETER | Yes | Sensor type. The value is fixed at **SensorId.PEDOMETER**. |
| callback | Callback<[PedometerResponse](#pedometerresponse)> | Yes | Callback used to report the sensor data, which is a **PedometerResponse** object.|
| callback | Callback<[PedometerResponse](#pedometerresponse)> | Yes | Callback used to report the sensor data, which is a **PedometerResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1521,7 +1521,7 @@ Obtains data of the pedometer sensor once.
...
@@ -1521,7 +1521,7 @@ Obtains data of the pedometer sensor once.
| type | [SensorId](#sensorid9).PEDOMETER_DETECTION | Yes | Sensor type. The value is fixed at **SensorId.PEDOMETER_DETECTION**. |
| type | [SensorId](#sensorid9).PEDOMETER_DETECTION | Yes | Sensor type. The value is fixed at **SensorId.PEDOMETER_DETECTION**. |
| callback | Callback<[PedometerDetectionResponse](#pedometerdetectionresponse)> | Yes | Callback used to report the sensor data, which is a **PedometerDetectionResponse** object.|
| callback | Callback<[PedometerDetectionResponse](#pedometerdetectionresponse)> | Yes | Callback used to report the sensor data, which is a **PedometerDetectionResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1556,7 +1556,7 @@ Obtains data of the proximity sensor once.
...
@@ -1556,7 +1556,7 @@ Obtains data of the proximity sensor once.
| type | [SensorId](#sensorid9).PROXIMITY | Yes | Sensor type. The value is fixed at **SensorId.PROXIMITY**. |
| type | [SensorId](#sensorid9).PROXIMITY | Yes | Sensor type. The value is fixed at **SensorId.PROXIMITY**. |
| callback | Callback<[ProximityResponse](#proximityresponse)> | Yes | Callback used to report the sensor data, which is a **ProximityResponse** object.|
| callback | Callback<[ProximityResponse](#proximityresponse)> | Yes | Callback used to report the sensor data, which is a **ProximityResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1591,7 +1591,7 @@ Obtains data of the rotation vector sensor once.
...
@@ -1591,7 +1591,7 @@ Obtains data of the rotation vector sensor once.
| type | [SensorId](#sensorid9).ROTATION_VECTOR | Yes | Sensor type. The value is fixed at **SensorId.ROTATION_VECTOR**. |
| type | [SensorId](#sensorid9).ROTATION_VECTOR | Yes | Sensor type. The value is fixed at **SensorId.ROTATION_VECTOR**. |
| callback | Callback<[RotationVectorResponse](#rotationvectorresponse)> | Yes | Callback used to report the sensor data, which is a **RotationVectorResponse** object.|
| callback | Callback<[RotationVectorResponse](#rotationvectorresponse)> | Yes | Callback used to report the sensor data, which is a **RotationVectorResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1629,7 +1629,7 @@ Obtains data of the significant motion sensor once.
...
@@ -1629,7 +1629,7 @@ Obtains data of the significant motion sensor once.
| type | [SensorId](#sensorid9).SIGNIFICANT_MOTION | Yes | Sensor type. The value is fixed at **SensorId.SIGNIFICANT_MOTION**. |
| type | [SensorId](#sensorid9).SIGNIFICANT_MOTION | Yes | Sensor type. The value is fixed at **SensorId.SIGNIFICANT_MOTION**. |
| callback | Callback<[SignificantMotionResponse](#significantmotionresponse)> | Yes | Callback used to report the sensor data, which is a **SignificantMotionResponse** object.|
| callback | Callback<[SignificantMotionResponse](#significantmotionresponse)> | Yes | Callback used to report the sensor data, which is a **SignificantMotionResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -1664,7 +1664,7 @@ Obtains data of the wear detection sensor once.
...
@@ -1664,7 +1664,7 @@ Obtains data of the wear detection sensor once.
| type | [SensorId](#sensorid9).WEAR_DETECTION | Yes | Sensor type. The value is fixed at **SensorId.WEAR_DETECTION**. |
| type | [SensorId](#sensorid9).WEAR_DETECTION | Yes | Sensor type. The value is fixed at **SensorId.WEAR_DETECTION**. |
| callback | Callback<[WearDetectionResponse](#weardetectionresponse)> | Yes | Callback used to report the sensor data, which is a **WearDetectionResponse** object.|
| callback | Callback<[WearDetectionResponse](#weardetectionresponse)> | Yes | Callback used to report the sensor data, which is a **WearDetectionResponse** object.|
**Error code**
**Error codes**
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md).
...
@@ -2596,7 +2596,7 @@ Obtains the geomagnetic field of a geographic location at a certain time. This A
...
@@ -2596,7 +2596,7 @@ Obtains the geomagnetic field of a geographic location at a certain time. This A
| timeMillis | number | Yes | Time when the magnetic declination is obtained. The value is a Unix timestamp, in ms.|
| timeMillis | number | Yes | Time when the magnetic declination is obtained. The value is a Unix timestamp, in ms.|
| callback | AsyncCallback<[GeomagneticResponse](#geomagneticresponse)> | Yes | Callback used to return the geomagnetic field. |
| callback | AsyncCallback<[GeomagneticResponse](#geomagneticresponse)> | Yes | Callback used to return the geomagnetic field. |
**Error code**
**Error codes**
For details about the following error codes, see [Error Codes of sensor.getGeomagneticInfo](../errorcodes/errorcode-sensor.md).
For details about the following error codes, see [Error Codes of sensor.getGeomagneticInfo](../errorcodes/errorcode-sensor.md).
...
@@ -2647,7 +2647,7 @@ Obtains the geomagnetic field of a geographic location at a certain time. This A
...
@@ -2647,7 +2647,7 @@ Obtains the geomagnetic field of a geographic location at a certain time. This A