diff --git a/en/application-dev/reference/apis/js-apis-sensor.md b/en/application-dev/reference/apis/js-apis-sensor.md index 7df95d23175b36a0e4aefa65ea0b04c1862a2c94..dd9d9e38aeaf04f38f38b12db89bc48888b70d7f 100644 --- a/en/application-dev/reference/apis/js-apis-sensor.md +++ b/en/application-dev/reference/apis/js-apis-sensor.md @@ -44,7 +44,7 @@ Subscribes to data of the acceleration sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -84,7 +84,7 @@ Subscribes to data of the uncalibrated acceleration sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -125,7 +125,7 @@ Subscribes to data of the ambient light sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -161,7 +161,7 @@ Subscribes to data of the ambient temperature sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -197,7 +197,7 @@ Subscribes to data of the barometer sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -233,7 +233,7 @@ Subscribes to data of the gravity sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -273,7 +273,7 @@ Subscribes to data of the gyroscope sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -314,7 +314,7 @@ Subscribes to data of the uncalibrated gyroscope sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -355,7 +355,7 @@ Subscribes to data of the Hall effect sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -393,7 +393,7 @@ Subscribes to data of the heart rate sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -429,7 +429,7 @@ Subscribes to data of the humidity sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -447,7 +447,7 @@ try { } ``` -### LINEAR_ACCELERATION9+ +### LINEAR_ACCELEROMETER9+ on(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback<LinearAccelerometerResponse>, options?: Options): void @@ -468,7 +468,7 @@ Subscribes to data of the linear acceleration sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -506,7 +506,7 @@ Subscribes to data of the magnetic field sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -544,7 +544,7 @@ Subscribes to data of the uncalibrated magnetic field sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -577,7 +577,7 @@ Subscribes to data of the orientation sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -617,7 +617,7 @@ Subscribes to data of the pedometer sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -664,7 +664,7 @@ Subscribe to data of the pedometer detection sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -700,7 +700,7 @@ Subscribes to data of the proximity sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -737,7 +737,7 @@ Subscribes to data of the rotation vector sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -777,7 +777,7 @@ Subscribes to data of the significant motion sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -814,7 +814,7 @@ Subscribes to data of the wear detection sensor. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -853,7 +853,7 @@ Subscribes to data of the acceleration sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -893,7 +893,7 @@ Subscribes to data of the uncalibrated acceleration sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -934,7 +934,7 @@ Subscribes to data of the ambient light sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -970,7 +970,7 @@ Subscribes to data of the ambient temperature sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1006,7 +1006,7 @@ Subscribes to data of the barometer sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1042,7 +1042,7 @@ Subscribes to data of the gravity sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1082,7 +1082,7 @@ Subscribes to data of the gyroscope sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1122,7 +1122,7 @@ Subscribes to data of the uncalibrated gyroscope sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1163,7 +1163,7 @@ Subscribes to data of the Hall effect sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1201,7 +1201,7 @@ Subscribes to data of the heart rate sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1237,7 +1237,7 @@ Subscribes to data of the humidity sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1256,7 +1256,7 @@ try { } ``` -### LINEAR_ACCELERATION9+ +### LINEAR_ACCELEROMETER9+ once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback<LinearAccelerometerResponse>): void @@ -1275,7 +1275,7 @@ Subscribes to data of the linear acceleration sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1313,7 +1313,7 @@ Subscribes to data of the magnetic field sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1351,7 +1351,7 @@ Subscribes to data of the uncalibrated magnetic field sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1392,7 +1392,7 @@ Subscribes to data of the orientation sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1432,7 +1432,7 @@ Subscribes to data of the pedometer sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1470,7 +1470,7 @@ Subscribe to data of the pedometer detection sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1506,7 +1506,7 @@ Subscribes to data of the proximity sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1542,7 +1542,7 @@ Subscribes to data of the rotation vector sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1581,7 +1581,7 @@ Subscribes to data of the significant motion sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -1617,7 +1617,7 @@ Subscribes to data of the wear detection sensor once. **Error code** -For details about the following error codes, see [Error Codes of ohos.sensor](../errorcodes/errorcode-sensor.md). +For details about the following error codes, see [Sensor Error Codes](../errorcodes/errorcode-sensor.md). | Error Code ID| Error Message | | -------- | ------------------ | @@ -3652,37 +3652,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.LI | callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | Yes | Callback used to return the linear acceleration sensor data. The reported data type in the callback is **LinearAccelerometerResponse**. | | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | -### LINEAR_ACCELEROMETER9+ - -on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:Callback<LinearAccelerometerResponse>, - options?: Options): void - -Subscribes to data changes of the linear acceleration sensor. If this API is called multiple times for the same application, the last call takes effect. - -**Required permissions**: ohos.permission.ACCELEROMETER - -**System capability**: SystemCapability.Sensors.Sensor - -**Parameters** - -| Name | Type | Mandatory | Description | -| -------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_LINEAR_ACCELEROMETER**. | -| callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | Yes | Callback used to return the linear acceleration sensor data. The reported data type in the callback is **LinearAccelerometerResponse**. | -| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | - -**Example** - - ```js - sensor.on(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER,function(data){ - console.info('X-coordinate component: ' + data.x); - console.info('Y-coordinate component: ' + data.y); - console.info('Z-coordinate component: ' + data.z); - }, - {interval: 10000000} - ); - ``` - ### ACCELEROMETER_UNCALIBRATED(deprecated) on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback: Callback<AccelerometerUncalibratedResponse>, options?: Options): void @@ -3704,7 +3673,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.AC | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | **Example** - ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,function(data){ console.info('X-coordinate component: ' + data.x); @@ -3737,7 +3705,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.GR | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | **Example** - ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,function(data){ console.info('X-coordinate component: ' + data.x); @@ -3769,7 +3736,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.GY | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | **Example** - ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,function(data){ console.info('X-coordinate component: ' + data.x); @@ -3801,7 +3767,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.GY | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. | **Example** - ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,function(data){ console.info('X-coordinate component: ' + data.x); @@ -3834,7 +3799,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.SI | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | **Example** - ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,function(data){ console.info('Scalar data: ' + data.scalar); @@ -3864,7 +3828,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.PE | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | **Example** - ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,function(data){ console.info('Scalar data: ' + data.scalar); @@ -3894,7 +3857,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.PE | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | **Example** - ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER,function(data){ console.info('Steps: ' + data.steps); @@ -3929,7 +3891,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.AM }, {interval: 10000000} ); - ``` ### MAGNETIC_FIELD(deprecated) @@ -3960,7 +3921,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.MA }, {interval: 10000000} ); - ``` ### MAGNETIC_FIELD_UNCALIBRATED(deprecated) @@ -3982,7 +3942,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.MA | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | **Example** - ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,function(data){ console.info('X-coordinate component: ' + data.x); @@ -3994,7 +3953,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.MA }, {interval: 10000000} ); - ``` ### PROXIMITY(deprecated) @@ -4016,14 +3974,12 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.PR | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | **Example** - ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY,function(data){ console.info('Distance: ' + data.distance); }, {interval: 10000000} ); - ``` ### HUMIDITY(deprecated) @@ -4052,7 +4008,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.HU }, {interval: 10000000} ); - ``` ### BAROMETER(deprecated) @@ -4081,7 +4036,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.BA }, {interval: 10000000} ); - ``` ### HALL(deprecated) @@ -4103,14 +4057,12 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.HA | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | **Example** - ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL,function(data){ console.info('Status: ' + data.status); }, {interval: 10000000} ); - ``` ### AMBIENT_LIGHT(deprecated) @@ -4160,7 +4112,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.OR | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | **Example** - ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,function(data){ console.info('The device rotates at an angle around the X axis: ' + data.beta); @@ -4169,7 +4120,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.OR }, {interval: 10000000} ); - ``` ### HEART_RATE(deprecated) @@ -4178,7 +4128,7 @@ on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRateRe Subscribes to only one data change of the heart rate sensor. -This API is deprecated since API version 9. You are advised to use [sensor.on.HEART_BEAT_RATE](#heart_beat_rate9) instead. +This API is deprecated since API version 9. You are advised to use [sensor.on.HEART_RATE](#heart_rate9) instead. **Required permissions**: ohos.permission.HEALTH_DATA @@ -4191,35 +4141,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.HE | type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HEART_RATE**. | | callback | Callback<[HeartRateResponse](#heartrateresponse)> | Yes | One-shot callback used to return the heart rate sensor data. The reported data type in the callback is **HeartRateResponse**. | -### HEART_BEAT_RATE9+ - -on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRateResponse>, - options?: Options): void - -Subscribes to only one data change of the heart rate sensor. - -**Required permissions**: ohos.permission.HEALTH_DATA - -**System capability**: SystemCapability.Sensors.Sensor - -**Parameters** - -| Name | Type | Mandatory | Description | -| -------- | ------------------------------------------------------- | --------- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HEART_BEAT_RATE**. | -| callback | Callback<[HeartRateResponse](#heartrateresponse)> | Yes | One-shot callback used to return the heart rate sensor data. The reported data type in the callback is **HeartRateResponse**. | - -**Example** - -```js -sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE,function(data){ - console.info("Heart rate: " + data.heartRate); -}, - {interval: 10000000} -); - -``` - ### ROTATION_VECTOR(deprecated) on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,callback: Callback<RotationVectorResponse>,options?: Options): void @@ -4239,7 +4160,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.RO | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | **Example** - ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,function(data){ console.info('X-coordinate component: ' + data.x); @@ -4270,14 +4190,12 @@ This API is deprecated since API version 9. You are advised to use [sensor.on.WE | options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. | **Example** - ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION,function(data){ console.info('Wear status: ' + data.value); }, {interval: 10000000} ); - ``` ## sensor.once(deprecated) @@ -4302,7 +4220,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[AccelerometerResponse](#accelerometerresponse)> | Yes | One-shot callback used to return the acceleration sensor data. The reported data type in the callback is **AccelerometerResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER,function(data){ console.info('X-coordinate component: ' + data.x); @@ -4310,7 +4227,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. console.info('Z-coordinate component: ' + data.z); } ); - ``` ### LINEAR_ACCELERATION(deprecated) @@ -4319,7 +4235,7 @@ once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:Callback<Li Subscribes to only one data change of the linear acceleration sensor. -This API is deprecated since API version 9. You are advised to use [sensor.once.LINEAR_ACCELEROMETER](#linear_accelerometer9) instead. +This API is deprecated since API version 9. You are advised to use [sensor.once.LINEAR_ACCELEROMETER](#linear_accelerometer9-1) instead. **Required permissions**: ohos.permission.ACCELERATION @@ -4332,35 +4248,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_LINEAR_ACCELERATION**. | | callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | Yes | One-shot callback used to return the linear acceleration sensor data. The reported data type in the callback is **LinearAccelerometerResponse**. | -### LINEAR_ACCELEROMETER9+ - -once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:Callback<LinearAccelerometerResponse>): void - -Subscribes to only one data change of the linear acceleration sensor. - -**Required permissions**: ohos.permission.ACCELERATION - -**System capability**: SystemCapability.Sensors.Sensor - -**Parameters** - -| Name | Type | Mandatory | Description | -| -------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_LINEAR_ACCELEROMETER**. | -| callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | Yes | One-shot callback used to return the linear acceleration sensor data. The reported data type in the callback is **LinearAccelerometerResponse**. | - -**Example** - - ```js - sensor.once(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, function(data) { - console.info('X-coordinate component: ' + data.x); - console.info('Y-coordinate component: ' + data.y); - console.info('Z-coordinate component: ' + data.z); - } - ); - - ``` - ### ACCELEROMETER_UNCALIBRATED(deprecated) once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback: Callback<AccelerometerUncalibratedResponse>): void @@ -4381,7 +4268,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)> | Yes | One-shot callback used to return the uncalibrated acceleration sensor data. The reported data type in the callback is **AccelerometerUncalibratedResponse**. | **Example** - ``` sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, function(data) { console.info('X-coordinate component: ' + data.x); @@ -4392,7 +4278,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. console.info('Z-coordinate bias: ' + data.biasZ); } ); - ``` ### GRAVITY(deprecated) @@ -4413,7 +4298,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[GravityResponse](#gravityresponse)> | Yes | One-shot callback used to return the gravity sensor data. The reported data type in the callback is **GravityResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, function(data) { console.info('X-coordinate component: ' + data.x); @@ -4421,7 +4305,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. console.info('Z-coordinate component: ' + data.z); } ); - ``` ### GYROSCOPE(deprecated) @@ -4444,7 +4327,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[GyroscopeResponse](#gyroscoperesponse)> | Yes | One-shot callback used to return the gyroscope sensor data. The reported data type in the callback is **GyroscopeResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, function(data) { console.info('X-coordinate component: ' + data.x); @@ -4452,7 +4334,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. console.info('Z-coordinate component: ' + data.z); } ); - ``` ### GYROSCOPE_UNCALIBRATED(deprecated) @@ -4475,7 +4356,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | Yes | One-shot callback used to return the uncalibrated gyroscope sensor data. The reported data type in the callback is **GyroscopeUncalibratedResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, function(data) { console.info('X-coordinate component: ' + data.x); @@ -4486,7 +4366,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. console.info('Z-coordinate bias: ' + data.biasZ); } ); - ``` ### SIGNIFICANT_MOTION(deprecated) @@ -4507,13 +4386,11 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[SignificantMotionResponse](#significantmotionresponse)> | Yes | One-shot callback used to return the significant motion sensor data. The reported data type in the callback is **SignificantMotionResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, function(data) { console.info('Scalar data: ' + data.scalar); } ); - ``` ### PEDOMETER_DETECTION(deprecated) @@ -4536,13 +4413,11 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[PedometerDetectionResponse](#pedometerdetectionresponse)> | Yes | One-shot callback used to return the pedometer detection sensor data. The reported data type in the callback is **PedometerDetectionResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, function(data) { console.info('Scalar data: ' + data.scalar); } ); - ``` ### PEDOMETER(deprecated) @@ -4565,7 +4440,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[PedometerResponse](#pedometerresponse)> | Yes | One-shot callback used to return the pedometer sensor data. The reported data type in the callback is **PedometerResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER, function(data) { console.info('Steps: ' + data.steps); @@ -4591,13 +4465,11 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | Yes | One-shot callback used to return the ambient temperature sensor data. The reported data type in the callback is **AmbientTemperatureResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, function(data) { console.info('Temperature: ' + data.temperature); } ); - ``` ### MAGNETIC_FIELD(deprecated) @@ -4618,7 +4490,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[MagneticFieldResponse](#magneticfieldresponse)> | Yes | One-shot callback used to return the magnetic field sensor data. The reported data type in the callback is **MagneticFieldResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, function(data) { console.info('X-coordinate component: ' + data.x); @@ -4626,7 +4497,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. console.info('Z-coordinate component: ' + data.z); } ); - ``` ### MAGNETIC_FIELD_UNCALIBRATED(deprecated) @@ -4647,7 +4517,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | Yes | One-shot callback used to return the uncalibrated magnetic field sensor data. The reported data type in the callback is **MagneticFieldUncalibratedResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, function(data) { console.info('X-coordinate component: ' + data.x); @@ -4658,7 +4527,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. console.info('Z-coordinate bias: ' + data.biasZ); } ); - ``` ### PROXIMITY(deprecated) @@ -4679,7 +4547,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[ProximityResponse](#proximityresponse)> | Yes | One-shot callback used to return the proximity sensor data. The reported data type in the callback is **ProximityResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY, function(data) { console.info('Distance: ' + data.distance); @@ -4705,13 +4572,11 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[HumidityResponse](#humidityresponse)> | Yes | One-shot callback used to return the humidity sensor data. The reported data type in the callback is **HumidityResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY, function(data) { console.info('Humidity: ' + data.humidity); } ); - ``` ### BAROMETER(deprecated) @@ -4732,13 +4597,11 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[BarometerResponse](#barometerresponse)> | Yes | One-shot callback used to return the barometer sensor data. The reported data type in the callback is **BarometerResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, function(data) { console.info('Atmospheric pressure: ' + data.pressure); } ); - ``` ### HALL(deprecated) @@ -4759,13 +4622,11 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[HallResponse](#hallresponse)> | Yes | One-shot callback used to return the Hall effect sensor data. The reported data type in the callback is **HallResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HALL, function(data) { console.info('Status: ' + data.status); } ); - ``` ### AMBIENT_LIGHT(deprecated) @@ -4792,7 +4653,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. console.info(' Illumination: ' + data.intensity); } ); - ``` ### ORIENTATION(deprecated) @@ -4813,7 +4673,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[OrientationResponse](#orientationresponse)> | Yes | One-shot callback used to return the orientation sensor data. The reported data type in the callback is **OrientationResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, function(data) { console.info('The device rotates at an angle around the X axis: ' + data.beta); @@ -4821,7 +4680,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. console.info('The device rotates at an angle around the Z axis: ' + data.alpha); } ); - ``` ### ROTATION_VECTOR(deprecated) @@ -4842,7 +4700,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[RotationVectorResponse](#rotationvectorresponse)> | Yes | One-shot callback used to return the rotation vector sensor data. The reported data type in the callback is **RotationVectorResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, function(data) { console.info('X-coordinate component: ' + data.x); @@ -4851,7 +4708,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. console.info('Scalar quantity: ' + data.w); } ); - ``` ### HEART_RATE(deprecated) @@ -4860,7 +4716,7 @@ once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRate Subscribes to only one data change of the heart rate sensor. -This API is deprecated since API version 9. You are advised to use [sensor.once.HEART_BEAT_RATE](#heart_beat_rate9) instead. +This API is deprecated since API version 9. You are advised to use [sensor.once.HEART_RATE](#heart_rate9-1) instead. **Required permissions**: ohos.permission.HEART_RATE @@ -4873,33 +4729,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HEART_RATE**. | | callback | Callback<[HeartRateResponse](#heartrateresponse)> | Yes | One-shot callback used to return the heart rate sensor data. The reported data type in the callback is **HeartRateResponse**. | -### HEART_BEAT_RATE9+ - -once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRateResponse>): void - -Subscribes to only one data change of the heart rate sensor. - -**Required permissions**: ohos.permission.HEART_RATE - -**System capability**: SystemCapability.Sensors.Sensor - -**Parameters** - -| Name | Type | Mandatory | Description | -| -------- | ------------------------------------------------------- | --------- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HEART_BEAT_RATE**. | -| callback | Callback<[HeartRateResponse](#heartrateresponse)> | Yes | One-shot callback used to return the heart rate sensor data. The reported data type in the callback is **HeartRateResponse**. | - -**Example** - - ```js - sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE, function(data) { - console.info("Heart rate: " + data.heartRate); - } - ); - - ``` - ### WEAR_DETECTION(deprecated) once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback<WearDetectionResponse>): void @@ -4918,13 +4747,11 @@ This API is deprecated since API version 9. You are advised to use [sensor.once. | callback | Callback<[WearDetectionResponse](#weardetectionresponse)> | Yes | One-shot callback used to return the wear detection sensor data. The reported data type in the callback is **WearDetectionResponse**. | **Example** - ```js sensor.once(sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, function(data) { console.info("Wear status: "+ data.value); } ); - ``` ## sensor.off(deprecated) @@ -4957,7 +4784,6 @@ function callback(data) { console.info('Z-coordinate component: ' + data.z); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback); - ``` ### ACCELEROMETER_UNCALIBRATED(deprecated) @@ -4991,7 +4817,6 @@ function callback(data) { console.info('Z-coordinate bias: ' + data.biasZ); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback); - ``` ### AMBIENT_LIGHT(deprecated) @@ -5018,7 +4843,6 @@ function callback(data) { console.info(' Illumination: ' + data.intensity); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback); - ``` ### AMBIENT_TEMPERATURE(deprecated) @@ -5045,7 +4869,6 @@ function callback(data) { console.info('Temperature: ' + data.temperature); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback); - ``` ### BAROMETER(deprecated) @@ -5130,7 +4953,6 @@ function callback(data) { console.info('Z-coordinate component: ' + data.z); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback); - ``` ### GYROSCOPE_UNCALIBRATED(deprecated) @@ -5161,7 +4983,6 @@ function callback(data) { console.info('Z-coordinate component: ' + data.z); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback); - ``` ### HALL(deprecated) @@ -5188,7 +5009,6 @@ function callback(data) { console.info('Status: ' + data.status); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback); - ``` ### HEART_RATE(deprecated) @@ -5197,7 +5017,7 @@ off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback<HeartRate Unsubscribes from sensor data changes. -This API is deprecated since API version 9. You are advised to use [sensor.off.HEART_BEAT_RATE](#heart_beat_rate9) instead. +This API is deprecated since API version 9. You are advised to use [sensor.off.HEART_RATE](#heart_rate9-2) instead. **Required permissions**: ohos.permission.HEALTH_DATA @@ -5210,33 +5030,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.off.H | type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_HEART_RATE**. | | callback | Callback<[HeartRateResponse](#heartrateresponse)> | Yes | One-shot callback used to return the heart rate sensor data. The reported data type in the callback is **HeartRateResponse**. | -### HEART_BEAT_RATE9+ - -off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback<HeartRateResponse>): void - -Unsubscribes from sensor data changes. - -**Required permissions**: ohos.permission.HEALTH_DATA - -**System capability**: SystemCapability.Sensors.Sensor - -**Parameters** - -| Name | Type | Mandatory | Description | -| -------- | ------------------------------------------------------- | --------- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_HEART_BEAT_RATE**. | -| callback | Callback<[HeartRateResponse](#heartrateresponse)> | Yes | One-shot callback used to return the heart rate sensor data. The reported data type in the callback is **HeartRateResponse**. | - -**Example** - -```js -function callback(data) { - console.info("Heart rate: " + data.heartRate); -} -sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE, callback); - -``` - ### HUMIDITY(deprecated) off(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback?: Callback<HumidityResponse>): void @@ -5261,7 +5054,6 @@ function callback(data) { console.info('Humidity: ' + data.humidity); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY, callback); - ``` ### LINEAR_ACCELERATION(deprecated) @@ -5270,7 +5062,7 @@ off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback< Unsubscribes from sensor data changes. -This API is deprecated since API version 9. You are advised to use [sensor.off.LINEAR_ACCELEROMETER](#linear_accelerometer9) instead. +This API is deprecated since API version 9. You are advised to use [sensor.off.LINEAR_ACCELEROMETER](#linear_accelerometer9-2) instead. **Required permissions**: ohos.permission.ACCELEROMETER @@ -5283,35 +5075,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.off.L | type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_LINEAR_ACCELERATION**. | | callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | Yes | Callback used to return the linear acceleration sensor data. The reported data type in the callback is **LinearAccelerometerResponse**. | -### LINEAR_ACCELEROMETER9+ - -off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback?:Callback<LinearAccelerometerResponse>): void - -Unsubscribes from sensor data changes. - -**Required permissions**: ohos.permission.ACCELEROMETER - -**System capability**: SystemCapability.Sensors.Sensor - -**Parameters** - -| Name | Type | Mandatory | Description | -| -------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_LINEAR_ACCELEROMETER**. | -| callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | Yes | Callback used to return the acceleration sensor data. The reported data type in the callback is **LinearAccelerometerResponse**. | - -**Example** - -```js -function callback(data) { - console.info('X-coordinate component: ' + data.x); - console.info('Y-coordinate component: ' + data.y); - console.info('Z-coordinate component: ' + data.z); -} -sensor.off(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback); - -``` - ### MAGNETIC_FIELD(deprecated) off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback?: Callback<MagneticFieldResponse>): void @@ -5338,7 +5101,6 @@ function callback(data) { console.info('Z-coordinate component: ' + data.z); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback); - ``` ### MAGNETIC_FIELD_UNCALIBRATED(deprecated) @@ -5370,7 +5132,6 @@ function callback(data) { console.info('Z-coordinate bias: ' + data.biasZ); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback); - ``` ### ORIENTATION(deprecated) @@ -5399,7 +5160,6 @@ function callback(data) { console.info('The device rotates at an angle around the Z axis: ' + data.alpha); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback); - ``` ### PEDOMETER(deprecated) @@ -5428,7 +5188,6 @@ function callback(data) { console.info('Steps: ' + data.steps); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER, callback); - ``` ### PEDOMETER_DETECTION(deprecated) @@ -5512,7 +5271,6 @@ function callback(data) { console.info('Scalar quantity: ' + data.w); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback); - ``` ### SIGNIFICANT_MOTION(deprecated) @@ -5539,7 +5297,6 @@ function callback(data) { console.info('Scalar data: ' + data.scalar); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback); - ``` ### WEAR_DETECTION(deprecated) @@ -5566,7 +5323,6 @@ function accCallback(data) { console.info('Wear status: ' + data.value); } sensor.off(sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, accCallback); - ``` ## sensor.transformCoordinateSystem(deprecated) @@ -5600,9 +5356,7 @@ sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {x:2, y:3}, functi console.info("transformCoordinateSystem data[ " + i + "] = " + data[i]); } }) - ``` - ## sensor.transformCoordinateSystem(deprecated) transformCoordinateSystem(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise<Array<number>> @@ -5638,7 +5392,6 @@ const promise = sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {x }).catch((err) => { console.info("Operation failed"); }) - ``` ## sensor.getGeomagneticField(deprecated) @@ -5660,7 +5413,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.getGe | callback | AsyncCallback<[GeomagneticResponse](#geomagneticresponse)> | Yes | Callback used to return the geomagnetic field. | **Example** - ```js sensor.getGeomagneticField({latitude:80, longitude:0, altitude:0}, 1580486400000, function(err, data) { if (err) { @@ -5671,9 +5423,7 @@ sensor.getGeomagneticField({latitude:80, longitude:0, altitude:0}, 1580486400000 data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity); }); - ``` - ## sensor.getGeomagneticField(deprecated) getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise<GeomagneticResponse> @@ -5698,7 +5448,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.getGe | Promise<[GeomagneticResponse](#geomagneticresponse)> | Promise used to return the geomagnetic field. | **Example** - ```js const promise = sensor.getGeomagneticField({latitude:80, longitude:0, altitude:0}, 1580486400000); promise.then((data) => { @@ -5708,7 +5457,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.getGe }).catch((reason) => { console.info('Operation failed.'); }) - ``` ## sensor.getAltitude(deprecated) @@ -5740,7 +5488,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.getDe } console.info("Successed to get getAltitude interface get data: " + data); }); - ``` ## sensor.getAltitude(deprecated) @@ -5775,7 +5522,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.getDe }).catch((err) => { console.error("Operation failed"); }) - ``` @@ -5873,7 +5619,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.getAn console.info("data[" + i + "]: " + data[i]); } }) - ``` @@ -5945,7 +5690,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.getRo console.info("data[" + i + "]: " + data[i]); } }) - ``` @@ -5983,7 +5727,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.getRo }).catch((reason) => { console.info("promise::catch", reason); }) - ``` @@ -6017,7 +5760,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.getQu console.info("data[" + i + "]: " + data[i]); } }) - ``` @@ -6089,7 +5831,6 @@ This API is deprecated since API version 9. You are advised to use [sensor.getOr console.info("sensor_getDirection_callback" + data[i]); } }) - ``` @@ -6194,5 +5935,3 @@ This API is deprecated since API version 9. You are advised to use [sensor.getRo console.info('promise failed'); }) ``` - - \ No newline at end of file