• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { AsyncCallback, Callback } from "./basic";
17
18/**
19 * This module provides the capability to subscribe to sensor data.
20 *
21 * @since 8
22 * @syscap SystemCapability.Sensors.Sensor
23 */
24declare namespace sensor {
25    /**
26     * Enum for obtain the type of sensor.
27     * @enum {number}
28     * @syscap SystemCapability.Sensors.Sensor
29     * @since 9
30     */
31     enum SensorId {
32        ACCELEROMETER = 1,          /**< Acceleration sensor */
33        GYROSCOPE = 2,              /**< Gyroscope sensor */
34        AMBIENT_LIGHT = 5,          /**< Ambient light sensor */
35        MAGNETIC_FIELD = 6,         /**< Magnetic field sensor */
36        BAROMETER = 8,              /**< Barometric pressure sensor */
37        HALL = 10,                  /**< Hall effect sensor */
38        PROXIMITY = 12,             /**< Proximity sensor */
39        HUMIDITY = 13,              /**< Humidity sensor */
40        ORIENTATION = 256,          /**< Orientation sensor */
41        GRAVITY = 257,              /**< Gravity sensor */
42        LINEAR_ACCELEROMETER = 258,  /**< Linear acceleration sensor */
43        ROTATION_VECTOR = 259,      /**< Rotation vector sensor */
44        AMBIENT_TEMPERATURE = 260,  /**< Ambient temperature sensor */
45        MAGNETIC_FIELD_UNCALIBRATED = 261,  /**< Uncalibrated magnetic field sensor */
46        GYROSCOPE_UNCALIBRATED = 263,  /**< Uncalibrated gyroscope sensor */
47        SIGNIFICANT_MOTION = 264,    /**< Significant motion sensor */
48        PEDOMETER_DETECTION = 265,   /**< Pedometer detection sensor */
49        PEDOMETER = 266,             /**< Pedometer sensor */
50        HEART_RATE = 278,            /**< Heart rate sensor */
51        WEAR_DETECTION = 280,        /**< Wear detection sensor */
52        ACCELEROMETER_UNCALIBRATED = 281   /**< Uncalibrated acceleration sensor */
53    }
54
55    /**
56     * Subscribe to accelerometer sensor data.
57     * @param { SensorId.ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}.
58     * @param { Callback<AccelerometerResponse> } callback - callback accelerometer data.
59     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
60     * @throws { BusinessError } 201 - Permission denied.
61     * @throws { BusinessError } 401 - Parameter error.
62     * @throws { BusinessError } 14500101 - Service exception.
63     * @permission ohos.permission.ACCELEROMETER
64     * @syscap SystemCapability.Sensors.Sensor
65     * @since 9
66     */
67     function on(type: SensorId.ACCELEROMETER, callback: Callback<AccelerometerResponse>,
68        options?: Options): void;
69
70    /**
71     * Subscribe to uncalibrated accelerometer sensor data.
72     * @param { SensorId.ACCELEROMETER_UNCALIBRATED } type - Indicate the sensor type to listen for,
73     *        {@code SensorId.ACCELEROMETER_UNCALIBRATED}.
74     * @param { Callback<AccelerometerUncalibratedResponse> } callback - callback uncalibrated accelerometer data.
75     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
76     * @throws { BusinessError } 201 - Permission denied.
77     * @throws { BusinessError } 401 - Parameter error.
78     * @throws { BusinessError } 14500101 - Service exception.
79     * @permission ohos.permission.ACCELEROMETER
80     * @syscap SystemCapability.Sensors.Sensor
81     * @since 9
82     */
83    function on(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>,
84        options?: Options): void;
85
86    /**
87     * Subscribe to ambient light sensor data.
88     * @param { SensorId.AMBIENT_LIGHT } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_LIGHT}.
89     * @param { Callback<LightResponse> } callback - callback ambient data.
90     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
91     * @throws { BusinessError } 401 - Parameter error.
92     * @throws { BusinessError } 14500101 - Service exception.
93     * @syscap SystemCapability.Sensors.Sensor
94     * @since 9
95     */
96    function on(type: SensorId.AMBIENT_LIGHT, callback: Callback<LightResponse>, options?: Options): void;
97
98    /**
99     * Subscribe to ambient temperature sensor data.
100     * @param { SensorId.AMBIENT_TEMPERATURE } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_TEMPERATURE}.
101     * @param { Callback<AmbientTemperatureResponse> } callback - callback temperature data.
102     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
103     * @throws { BusinessError } 401 - Parameter error.
104     * @throws { BusinessError } 14500101 - Service exception.
105     * @syscap SystemCapability.Sensors.Sensor
106     * @since 9
107     */
108    function on(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>,
109        options?: Options): void;
110
111    /**
112     * Subscribe to barometer sensor data.
113     * @param { SensorId.BAROMETER } type - Indicate the sensor type to listen for, {@code SensorId.BAROMETER}.
114     * @param { Callback<BarometerResponse> } callback - callback barometer data.
115     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
116     * @throws { BusinessError } 401 - Parameter error.
117     * @throws { BusinessError } 14500101 - Service exception.
118     * @syscap SystemCapability.Sensors.Sensor
119     * @since 9
120     */
121    function on(type: SensorId.BAROMETER, callback: Callback<BarometerResponse>, options?: Options): void;
122
123    /**
124     * Subscribe to gravity sensor data.
125     * @param { SensorId.GRAVITY } type - Indicate the sensor type to listen for, {@code SensorId.GRAVITY}.
126     * @param { Callback<GravityResponse> } callback - callback gravity data.
127     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
128     * @throws { BusinessError } 401 - Parameter error.
129     * @throws { BusinessError } 14500101 - Service exception.
130     * @syscap SystemCapability.Sensors.Sensor
131     * @since 9
132     */
133    function on(type: SensorId.GRAVITY, callback: Callback<GravityResponse>,
134        options?: Options): void;
135
136    /**
137     * Subscribe to gyroscope sensor data.
138     * @param { SensorId.GYROSCOPE } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}.
139     * @param { Callback<GyroscopeResponse> } callback - callback gyroscope data.
140     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
141     * @throws { BusinessError } 201 - Permission denied.
142     * @throws { BusinessError } 401 - Parameter error.
143     * @throws { BusinessError } 14500101 - Service exception.
144     * @permission ohos.permission.GYROSCOPE
145     * @syscap SystemCapability.Sensors.Sensor
146     * @since 9
147     */
148    function on(type: SensorId.GYROSCOPE, callback: Callback<GyroscopeResponse>,
149        options?: Options): void;
150
151    /**
152     * Subscribe to uncalibrated gyroscope sensor data.
153     * @param { SensorId.GYROSCOPE_UNCALIBRATED } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE_UNCALIBRATED}.
154     * @param { Callback<GyroscopeUncalibratedResponse> } callback - callback uncalibrated gyroscope data.
155     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
156     * @throws { BusinessError } 201 - Permission denied.
157     * @throws { BusinessError } 401 - Parameter error.
158     * @throws { BusinessError } 14500101 - Service exception.
159     * @permission ohos.permission.GYROSCOPE
160     * @syscap SystemCapability.Sensors.Sensor
161     * @since 9
162     */
163    function on(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>,
164        options?: Options): void;
165
166    /**
167     * Subscribe to hall sensor data.
168     * @param { SensorId.HALL } type - Indicate the sensor type to listen for, {@code SensorId.HALL}.
169     * @param { Callback<HallResponse> } callback - callback uncalibrated gyroscope data.
170     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
171     * @throws { BusinessError } 401 - Parameter error.
172     * @throws { BusinessError } 14500101 - Service exception.
173     * @syscap SystemCapability.Sensors.Sensor
174     * @since 9
175     */
176    function on(type: SensorId.HALL, callback: Callback<HallResponse>, options?: Options): void;
177
178    /**
179     * Subscribe to heart rate sensor data.
180     * @param { SensorId.HEART_RATE } type - Indicate the sensor type to listen for, {@code SensorId.HEART_RATE}.
181     * @param { Callback<HeartRateResponse> } callback - callback heart rate data.
182     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
183     * @throws { BusinessError } 201 - Permission denied.
184     * @throws { BusinessError } 401 - Parameter error.
185     * @throws { BusinessError } 14500101 - Service exception.
186     * @permission ohos.permission.READ_HEALTH_DATA
187     * @syscap SystemCapability.Sensors.Sensor
188     * @since 9
189     */
190    function on(type: SensorId.HEART_RATE, callback: Callback<HeartRateResponse>,
191        options?: Options): void;
192
193    /**
194     * Subscribe to humidity sensor data.
195     * @param { SensorId.HUMIDITY } type - Indicate the sensor type to listen for, {@code SensorId.HUMIDITY}.
196     * @param { Callback<HumidityResponse> } callback - callback humidity data.
197     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
198     * @throws { BusinessError } 401 - Parameter error.
199     * @throws { BusinessError } 14500101 - Service exception.
200     * @syscap SystemCapability.Sensors.Sensor
201     * @since 9
202     */
203    function on(type: SensorId.HUMIDITY, callback: Callback<HumidityResponse>,
204        options?: Options): void;
205
206    /**
207     * Subscribe to linear acceleration sensor data.
208     * @param { SensorId.LINEAR_ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.LINEAR_ACCELEROMETER}.
209     * @param { Callback<LinearAccelerometerResponse> } callback - callback linear acceleration data.
210     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
211     * @throws { BusinessError } 201 - Permission denied.
212     * @throws { BusinessError } 401 - Parameter error.
213     * @throws { BusinessError } 14500101 - Service exception.
214     * @permission ohos.permission.ACCELEROMETER
215     * @syscap SystemCapability.Sensors.Sensor
216     * @since 9
217     */
218    function on(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback<LinearAccelerometerResponse>,
219        options?: Options): void;
220
221    /**
222     * Subscribe to magnetic field sensor data.
223     * @param { SensorId.MAGNETIC_FIELD } type - Indicate the sensor type to listen for, {@code SensorId.MAGNETIC_FIELD}.
224     * @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data.
225     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
226     * @throws { BusinessError } 401 - Parameter error.
227     * @throws { BusinessError } 14500101 - Service exception.
228     * @syscap SystemCapability.Sensors.Sensor
229     * @since 9
230     */
231    function on(type: SensorId.MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>,
232        options?: Options): void;
233
234    /**
235     * Subscribe to uncalibrated magnetic field sensor data.
236     * @param { SensorId.MAGNETIC_FIELD_UNCALIBRATED } type - Indicate the sensor type to listen for,
237     *        {@code SensorId.MAGNETIC_FIELD_UNCALIBRATED}.
238     * @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback uncalibrated magnetic field data.
239     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
240     * @throws { BusinessError } 401 - Parameter error.
241     * @throws { BusinessError } 14500101 - Service exception.
242     * @syscap SystemCapability.Sensors.Sensor
243     * @since 9
244     */
245    function on(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>,
246        options?: Options): void;
247
248    /**
249     * Subscribe to orientation sensor data.
250     * @param { SensorId.ORIENTATION } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}.
251     * @param { Callback<OrientationResponse> } callback - callback orientation data.
252     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
253     * @throws { BusinessError } 401 - Parameter error.
254     * @throws { BusinessError } 14500101 - Service exception.
255     * @syscap SystemCapability.Sensors.Sensor
256     * @since 9
257     */
258    function on(type: SensorId.ORIENTATION, callback: Callback<OrientationResponse>,
259        options?: Options): void;
260
261    /**
262     * Subscribe to pedometer sensor data.
263     * @param { SensorId.PEDOMETER } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER}.
264     * @param { Callback<PedometerResponse> } callback - callback pedometer data.
265     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
266     * @throws { BusinessError } 201 - Permission denied.
267     * @throws { BusinessError } 401 - Parameter error.
268     * @throws { BusinessError } 14500101 - Service exception.
269     * @permission ohos.permission.ACTIVITY_MOTION
270     * @syscap SystemCapability.Sensors.Sensor
271     * @since 9
272     */
273    function on(type: SensorId.PEDOMETER, callback: Callback<PedometerResponse>, options?: Options): void;
274
275    /**
276     * Subscribe to pedometer detection sensor data.
277     * @param { SensorId.PEDOMETER_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER_DETECTION}.
278     * @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data.
279     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
280     * @throws { BusinessError } 201 - Permission denied.
281     * @throws { BusinessError } 401 - Parameter error.
282     * @throws { BusinessError } 14500101 - Service exception.
283     * @permission ohos.permission.ACTIVITY_MOTION
284     * @syscap SystemCapability.Sensors.Sensor
285     * @since 9
286     */
287    function on(type: SensorId.PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>,
288        options?: Options): void;
289
290    /**
291     * Subscribe to proximity sensor data.
292     * @param { SensorId.PROXIMITY } type - Indicate the sensor type to listen for, {@code SensorId.PROXIMITY}.
293     * @param { Callback<ProximityResponse> } callback - callback proximity data.
294     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
295     * @throws { BusinessError } 401 - Parameter error.
296     * @throws { BusinessError } 14500101 - Service exception.
297     * @syscap SystemCapability.Sensors.Sensor
298     * @since 9
299     */
300    function on(type: SensorId.PROXIMITY, callback: Callback<ProximityResponse>, options?: Options): void;
301
302    /**
303     * Subscribe to rotation vector sensor data.
304     * @param { SensorId.ROTATION_VECTOR } type - Indicate the sensor type to listen for, {@code SensorId.ROTATION_VECTOR}.
305     * @param { Callback<RotationVectorResponse> } callback - callback rotation vector data.
306     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
307     * @throws { BusinessError } 401 - Parameter error.
308     * @throws { BusinessError } 14500101 - Service exception.
309     * @syscap SystemCapability.Sensors.Sensor
310     * @since 9
311     */
312    function on(type: SensorId.ROTATION_VECTOR, callback: Callback<RotationVectorResponse>,
313        options?: Options): void;
314
315    /**
316     * Subscribe to significant motion sensor data.
317     * @param { SensorId.SIGNIFICANT_MOTION } type - Indicate the sensor type to listen for, {@code SensorId.SIGNIFICANT_MOTION}.
318     * @param { Callback<SignificantMotionResponse> } callback - callback significant motion data.
319     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
320     * @throws { BusinessError } 401 - Parameter error.
321     * @throws { BusinessError } 14500101 - Service exception.
322     * @syscap SystemCapability.Sensors.Sensor
323     * @since 9
324     */
325    function on(type: SensorId.SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>,
326        options?: Options): void;
327
328    /**
329     * Subscribe to wear detection sensor data.
330     * @param { SensorId.WEAR_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.WEAR_DETECTION}.
331     * @param { Callback<RotationVectorResponse> } callback - callback wear detection data.
332     * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
333     * @throws { BusinessError } 401 - Parameter error.
334     * @throws { BusinessError } 14500101 - Service exception.
335     * @syscap SystemCapability.Sensors.Sensor
336     * @since 9
337     */
338    function on(type: SensorId.WEAR_DETECTION, callback: Callback<WearDetectionResponse>,
339        options?: Options): void;
340
341    /**
342     * Subscribe to accelerometer sensor data once.
343     * @param { SensorId.ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}.
344     * @param { Callback<AccelerometerResponse> } callback - callback accelerometer data.
345     * @throws { BusinessError } 201 - Permission denied.
346     * @throws { BusinessError } 401 - Parameter error.
347     * @throws { BusinessError } 14500101 - Service exception.
348     * @permission ohos.permission.ACCELEROMETER
349     * @syscap SystemCapability.Sensors.Sensor
350     * @since 9
351     */
352     function once(type: SensorId.ACCELEROMETER, callback: Callback<AccelerometerResponse>): void;
353
354    /**
355     * Subscribe to uncalibrated accelerometer sensor data once.
356     * @param { SensorId.ACCELEROMETER_UNCALIBRATED } type - Indicate the sensor type to listen for,
357     *        {@code SensorId.ACCELEROMETER_UNCALIBRATED}.
358     * @param { Callback<AccelerometerUncalibratedResponse> } callback - callback uncalibrated accelerometer data.
359     * @throws { BusinessError } 201 - Permission denied.
360     * @throws { BusinessError } 401 - Parameter error.
361     * @throws { BusinessError } 14500101 - Service exception.
362     * @permission ohos.permission.ACCELEROMETER
363     * @syscap SystemCapability.Sensors.Sensor
364     * @since 9
365     */
366    function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>): void;
367
368    /**
369     * Subscribe to ambient light sensor data once.
370     * @param { SensorId.AMBIENT_LIGHT } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_LIGHT}.
371     * @param { Callback<LightResponse> } callback - callback ambient data.
372     * @throws { BusinessError } 401 - Parameter error.
373     * @throws { BusinessError } 14500101 - Service exception.
374     * @syscap SystemCapability.Sensors.Sensor
375     * @since 9
376     */
377    function once(type: SensorId.AMBIENT_LIGHT, callback: Callback<LightResponse>): void;
378
379    /**
380     * Subscribe to ambient temperature sensor data once.
381     * @param { SensorId.AMBIENT_TEMPERATURE } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_TEMPERATURE}.
382     * @param { Callback<AmbientTemperatureResponse> } callback - callback temperature data.
383     * @throws { BusinessError } 401 - Parameter error.
384     * @throws { BusinessError } 14500101 - Service exception.
385     * @syscap SystemCapability.Sensors.Sensor
386     * @since 9
387     */
388    function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>): void;
389
390    /**
391     * Subscribe to barometer sensor data once.
392     * @param { SensorId.BAROMETER } type - Indicate the sensor type to listen for, {@code SensorId.BAROMETER}.
393     * @param { Callback<BarometerResponse> } callback - callback barometer data.
394     * @throws { BusinessError } 401 - Parameter error.
395     * @throws { BusinessError } 14500101 - Service exception.
396     * @syscap SystemCapability.Sensors.Sensor
397     * @since 9
398     */
399    function once(type: SensorId.BAROMETER, callback: Callback<BarometerResponse>): void;
400
401    /**
402     * Subscribe to gravity sensor data once.
403     * @param { SensorId.GRAVITY } type - Indicate the sensor type to listen for, {@code SensorId.GRAVITY}.
404     * @param { Callback<GravityResponse> } callback - callback gravity data.
405     * @throws { BusinessError } 401 - Parameter error.
406     * @throws { BusinessError } 14500101 - Service exception.
407     * @syscap SystemCapability.Sensors.Sensor
408     * @since 9
409     */
410    function once(type: SensorId.GRAVITY, callback: Callback<GravityResponse>): void;
411
412    /**
413     * Subscribe to gyroscope sensor data once.
414     * @param { SensorId.GYROSCOPE } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}.
415     * @param { Callback<GyroscopeResponse> } callback - callback gyroscope data.
416     * @throws { BusinessError } 201 - Permission denied.
417     * @throws { BusinessError } 401 - Parameter error.
418     * @throws { BusinessError } 14500101 - Service exception.
419     * @permission ohos.permission.GYROSCOPE
420     * @syscap SystemCapability.Sensors.Sensor
421     * @since 9
422     */
423    function once(type: SensorId.GYROSCOPE, callback: Callback<GyroscopeResponse>): void;
424
425    /**
426     * Subscribe to uncalibrated gyroscope sensor data once.
427     * @param { SensorId.GYROSCOPE_UNCALIBRATED } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE_UNCALIBRATED}.
428     * @param { Callback<GyroscopeUncalibratedResponse> } callback - callback uncalibrated gyroscope data.
429     * @throws { BusinessError } 201 - Permission denied.
430     * @throws { BusinessError } 401 - Parameter error.
431     * @throws { BusinessError } 14500101 - Service exception.
432     * @permission ohos.permission.GYROSCOPE
433     * @syscap SystemCapability.Sensors.Sensor
434     * @since 9
435     */
436    function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>): void;
437
438    /**
439     * Subscribe to hall sensor data once.
440     * @param { SensorId.HALL } type - Indicate the sensor type to listen for, {@code SensorId.HALL}.
441     * @param { Callback<HallResponse> } callback - callback uncalibrated gyroscope data.
442     * @throws { BusinessError } 401 - Parameter error.
443     * @throws { BusinessError } 14500101 - Service exception.
444     * @syscap SystemCapability.Sensors.Sensor
445     * @since 9
446     */
447    function once(type: SensorId.HALL, callback: Callback<HallResponse>): void;
448
449    /**
450     * Subscribe to heart rate sensor data once.
451     * @param { SensorId.HEART_RATE } type - Indicate the sensor type to listen for, {@code SensorId.HEART_RATE}.
452     * @param { Callback<HeartRateResponse> } callback - callback heart rate data.
453     * @throws { BusinessError } 201 - Permission denied.
454     * @throws { BusinessError } 401 - Parameter error.
455     * @throws { BusinessError } 14500101 - Service exception.
456     * @permission ohos.permission.READ_HEALTH_DATA
457     * @syscap SystemCapability.Sensors.Sensor
458     * @since 9
459     */
460    function once(type: SensorId.HEART_RATE, callback: Callback<HeartRateResponse>): void;
461
462    /**
463     * Subscribe to humidity sensor data once.
464     * @param { SensorId.HUMIDITY } type - Indicate the sensor type to listen for, {@code SensorId.HUMIDITY}.
465     * @param { Callback<HumidityResponse> } callback - callback humidity data.
466     * @throws { BusinessError } 401 - Parameter error.
467     * @throws { BusinessError } 14500101 - Service exception.
468     * @syscap SystemCapability.Sensors.Sensor
469     * @since 9
470     */
471    function once(type: SensorId.HUMIDITY, callback: Callback<HumidityResponse>): void;
472
473    /**
474     * Subscribe to linear acceleration sensor data once.
475     * @param { SensorId.LINEAR_ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.LINEAR_ACCELEROMETER}.
476     * @param { Callback<LinearAccelerometerResponse> } callback - callback linear acceleration data.
477     * @throws { BusinessError } 201 - Permission denied.
478     * @throws { BusinessError } 401 - Parameter error.
479     * @throws { BusinessError } 14500101 - Service exception.
480     * @permission ohos.permission.ACCELEROMETER
481     * @syscap SystemCapability.Sensors.Sensor
482     * @since 9
483     */
484    function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback<LinearAccelerometerResponse>): void;
485
486    /**
487     * Subscribe to magnetic field sensor data once.
488     * @param { SensorId.MAGNETIC_FIELD } type - Indicate the sensor type to listen for, {@code SensorId.MAGNETIC_FIELD}.
489     * @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data.
490     * @throws { BusinessError } 401 - Parameter error.
491     * @throws { BusinessError } 14500101 - Service exception.
492     * @syscap SystemCapability.Sensors.Sensor
493     * @since 9
494     */
495    function once(type: SensorId.MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>): void;
496
497    /**
498     * Subscribe to uncalibrated magnetic field sensor data once.
499     * @param { SensorId.MAGNETIC_FIELD_UNCALIBRATED } type - Indicate the sensor type to listen for,
500     *        {@code SensorId.MAGNETIC_FIELD_UNCALIBRATED}.
501     * @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback uncalibrated magnetic field data.
502     * @throws { BusinessError } 401 - Parameter error.
503     * @throws { BusinessError } 14500101 - Service exception.
504     * @syscap SystemCapability.Sensors.Sensor
505     * @since 9
506     */
507    function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>): void;
508
509    /**
510     * Subscribe to orientation sensor data once.
511     * @param { SensorId.ORIENTATION } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}.
512     * @param { Callback<OrientationResponse> } callback - callback orientation data.
513     * @throws { BusinessError } 401 - Parameter error.
514     * @throws { BusinessError } 14500101 - Service exception.
515     * @syscap SystemCapability.Sensors.Sensor
516     * @since 9
517     */
518    function once(type: SensorId.ORIENTATION, callback: Callback<OrientationResponse>): void;
519
520    /**
521     * Subscribe to pedometer sensor data once.
522     * @param { SensorId.PEDOMETER } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER}.
523     * @param { Callback<PedometerResponse> } callback - callback pedometer data.
524     * @throws { BusinessError } 201 - Permission denied.
525     * @throws { BusinessError } 401 - Parameter error.
526     * @throws { BusinessError } 14500101 - Service exception.
527     * @permission ohos.permission.ACTIVITY_MOTION
528     * @syscap SystemCapability.Sensors.Sensor
529     * @since 9
530     */
531    function once(type: SensorId.PEDOMETER, callback: Callback<PedometerResponse>): void;
532
533    /**
534     * Subscribe to pedometer detection sensor data once.
535     * @param { SensorId.PEDOMETER_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER_DETECTION}.
536     * @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data.
537     * @throws { BusinessError } 201 - Permission denied.
538     * @throws { BusinessError } 401 - Parameter error.
539     * @throws { BusinessError } 14500101 - Service exception.
540     * @permission ohos.permission.ACTIVITY_MOTION
541     * @syscap SystemCapability.Sensors.Sensor
542     * @since 9
543     */
544    function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>): void;
545
546    /**
547     * Subscribe to proximity sensor data once.
548     * @param { SensorId.PROXIMITY } type - Indicate the sensor type to listen for, {@code SensorId.PROXIMITY}.
549     * @param { Callback<ProximityResponse> } callback - callback proximity data.
550     * @throws { BusinessError } 401 - Parameter error.
551     * @throws { BusinessError } 14500101 - Service exception.
552     * @syscap SystemCapability.Sensors.Sensor
553     * @since 9
554     */
555    function once(type: SensorId.PROXIMITY, callback: Callback<ProximityResponse>): void;
556
557    /**
558     * Subscribe to rotation vector sensor data once.
559     * @param { SensorId.ROTATION_VECTOR } type - Indicate the sensor type to listen for, {@code SensorId.ROTATION_VECTOR}.
560     * @param { Callback<RotationVectorResponse> } callback - callback rotation vector data.
561     * @throws { BusinessError } 401 - Parameter error.
562     * @throws { BusinessError } 14500101 - Service exception.
563     * @syscap SystemCapability.Sensors.Sensor
564     * @since 9
565     */
566    function once(type: SensorId.ROTATION_VECTOR, callback: Callback<RotationVectorResponse>): void;
567
568    /**
569     * Subscribe to significant motion sensor data once.
570     * @param { SensorId.SIGNIFICANT_MOTION } type - Indicate the sensor type to listen for, {@code SensorId.SIGNIFICANT_MOTION}.
571     * @param { Callback<SignificantMotionResponse> } callback - callback significant motion data.
572     * @throws { BusinessError } 401 - Parameter error.
573     * @throws { BusinessError } 14500101 - Service exception.
574     * @syscap SystemCapability.Sensors.Sensor
575     * @since 9
576     */
577    function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>): void;
578
579    /**
580     * Subscribe to wear detection sensor data once.
581     * @param { SensorId.WEAR_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.WEAR_DETECTION}.
582     * @param { Callback<RotationVectorResponse> } callback - callback wear detection data.
583     * @throws { BusinessError } 401 - Parameter error.
584     * @throws { BusinessError } 14500101 - Service exception.
585     *
586     * @syscap SystemCapability.Sensors.Sensor
587     * @since 9
588     */
589    function once(type: SensorId.WEAR_DETECTION, callback: Callback<WearDetectionResponse>): void;
590    /**
591     * Unsubscribe to accelerometer sensor data.
592     * @param { SensorId.ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}.
593     * @param { Callback<AccelerometerResponse> } callback - callback accelerometer data.
594     * @throws { BusinessError } 201 - Permission denied.
595     * @throws { BusinessError } 401 - Parameter error.
596     * @permission ohos.permission.ACCELEROMETER
597     * @syscap SystemCapability.Sensors.Sensor
598     * @since 9
599     */
600     function off(type: SensorId.ACCELEROMETER, callback?: Callback<AccelerometerResponse>): void;
601
602    /**
603     * Unsubscribe to uncalibrated accelerometer sensor data.
604     * @param { SensorId.ACCELEROMETER_UNCALIBRATED } type - Indicate the sensor type to listen for,
605     *        {@code SensorId.ACCELEROMETER_UNCALIBRATED}.
606     * @param { Callback<AccelerometerUncalibratedResponse> } callback - callback uncalibrated accelerometer data.
607     * @throws { BusinessError } 201 - Permission denied.
608     * @throws { BusinessError } 401 - Parameter error.
609     * @permission ohos.permission.ACCELEROMETER
610     * @syscap SystemCapability.Sensors.Sensor
611     * @since 9
612     */
613    function off(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback?: Callback<AccelerometerUncalibratedResponse>): void;
614
615    /**
616     * Unsubscribe to ambient light sensor data.
617     * @param { SensorId.AMBIENT_LIGHT } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_LIGHT}.
618     * @param { Callback<LightResponse> } callback - callback ambient data.
619     * @throws { BusinessError } 401 - Parameter error.
620     * @syscap SystemCapability.Sensors.Sensor
621     * @since 9
622     */
623    function off(type: SensorId.AMBIENT_LIGHT, callback?: Callback<LightResponse>): void;
624
625    /**
626     * Unsubscribe to ambient temperature sensor data.
627     * @param { SensorId.AMBIENT_TEMPERATURE } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_TEMPERATURE}.
628     * @param { Callback<AmbientTemperatureResponse> } callback - callback temperature data.
629     * @throws { BusinessError } 401 - Parameter error.
630     * @syscap SystemCapability.Sensors.Sensor
631     * @since 9
632     */
633    function off(type: SensorId.AMBIENT_TEMPERATURE, callback?: Callback<AmbientTemperatureResponse>): void;
634
635    /**
636     * Unsubscribe to barometer sensor data.
637     * @param { SensorId.BAROMETER } type - Indicate the sensor type to listen for, {@code SensorId.BAROMETER}.
638     * @param { Callback<BarometerResponse> } callback - callback barometer data.
639     * @throws { BusinessError } 401 - Parameter error.
640     * @syscap SystemCapability.Sensors.Sensor
641     * @since 9
642     */
643    function off(type: SensorId.BAROMETER, callback?: Callback<BarometerResponse>): void;
644
645    /**
646     * Unsubscribe to gravity sensor data.
647     * @param { SensorId.GRAVITY } type - Indicate the sensor type to listen for, {@code SensorId.GRAVITY}.
648     * @param { Callback<GravityResponse> } callback - callback gravity data.
649     * @throws { BusinessError } 401 - Parameter error.
650     * @syscap SystemCapability.Sensors.Sensor
651     * @since 9
652     */
653    function off(type: SensorId.GRAVITY, callback?: Callback<GravityResponse>): void;
654
655    /**
656     * Unsubscribe to gyroscope sensor data.
657     * @param { SensorId.GYROSCOPE } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}.
658     * @param { Callback<GyroscopeResponse> } callback - callback gyroscope data.
659     * @throws { BusinessError } 201 - Permission denied.
660     * @throws { BusinessError } 401 - Parameter error.
661     * @permission ohos.permission.GYROSCOPE
662     * @syscap SystemCapability.Sensors.Sensor
663     * @since 9
664     */
665    function off(type: SensorId.GYROSCOPE, callback?: Callback<GyroscopeResponse>): void;
666
667    /**
668     * Unsubscribe to uncalibrated gyroscope sensor data.
669     * @param { SensorId.GYROSCOPE_UNCALIBRATED } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE_UNCALIBRATED}.
670     * @param { Callback<GyroscopeUncalibratedResponse> } callback - callback uncalibrated gyroscope data.
671     * @throws { BusinessError } 201 - Permission denied.
672     * @throws { BusinessError } 401 - Parameter error.
673     * @permission ohos.permission.GYROSCOPE
674     * @syscap SystemCapability.Sensors.Sensor
675     * @since 9
676     */
677    function off(type: SensorId.GYROSCOPE_UNCALIBRATED, callback?: Callback<GyroscopeUncalibratedResponse>): void;
678
679    /**
680     * Unsubscribe to hall sensor data.
681     * @param { SensorId.HALL } type - Indicate the sensor type to listen for, {@code SensorId.HALL}.
682     * @param { Callback<HallResponse> } callback - callback uncalibrated gyroscope data.
683     * @throws { BusinessError } 401 - Parameter error.
684     * @syscap SystemCapability.Sensors.Sensor
685     * @since 9
686     */
687    function off(type: SensorId.HALL, callback?: Callback<HallResponse>): void;
688
689    /**
690     * Unsubscribe to heart rate sensor data.
691     * @param { SensorId.HEART_RATE } type - Indicate the sensor type to listen for, {@code SensorId.HEART_RATE}.
692     * @param { Callback<HeartRateResponse> } callback - callback heart rate data.
693     * @throws { BusinessError } 201 - Permission denied.
694     * @throws { BusinessError } 401 - Parameter error.
695     * @permission ohos.permission.READ_HEALTH_DATA
696     * @syscap SystemCapability.Sensors.Sensor
697     * @since 9
698     */
699    function off(type: SensorId.HEART_RATE, callback?: Callback<HeartRateResponse>): void;
700
701    /**
702     * Unsubscribe to humidity sensor data.
703     * @param { SensorId.HUMIDITY } type - Indicate the sensor type to listen for, {@code SensorId.HUMIDITY}.
704     * @param { Callback<HumidityResponse> } callback - callback humidity data.
705     * @throws { BusinessError } 401 - Parameter error.
706     * @syscap SystemCapability.Sensors.Sensor
707     * @since 9
708     */
709    function off(type: SensorId.HUMIDITY, callback?: Callback<HumidityResponse>): void;
710
711    /**
712     * Unsubscribe to linear acceleration sensor data.
713     * @param { SensorId.LINEAR_ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.LINEAR_ACCELEROMETER}.
714     * @param { Callback<LinearAccelerometerResponse> } callback - callback linear acceleration data.
715     * @throws { BusinessError } 201 - Permission denied.
716     * @throws { BusinessError } 401 - Parameter error.
717     * @permission ohos.permission.ACCELEROMETER
718     * @syscap SystemCapability.Sensors.Sensor
719     * @since 9
720     */
721    function off(type: SensorId.LINEAR_ACCELEROMETER, callback?: Callback<LinearAccelerometerResponse>): void;
722
723    /**
724     * Unsubscribe to magnetic field sensor data.
725     * @param { SensorId.MAGNETIC_FIELD } type - Indicate the sensor type to listen for, {@code SensorId.MAGNETIC_FIELD}.
726     * @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data.
727     * @throws { BusinessError } 401 - Parameter error.
728     * @syscap SystemCapability.Sensors.Sensor
729     * @since 9
730     */
731    function off(type: SensorId.MAGNETIC_FIELD, callback?: Callback<MagneticFieldResponse>): void;
732
733    /**
734     * Unsubscribe to uncalibrated magnetic field sensor data.
735     * @param { SensorId.MAGNETIC_FIELD_UNCALIBRATED } type - Indicate the sensor type to listen for,
736     *        {@code SensorId.MAGNETIC_FIELD_UNCALIBRATED}.
737     * @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback uncalibrated magnetic field data.
738     * @throws { BusinessError } 401 - Parameter error.
739     * @syscap SystemCapability.Sensors.Sensor
740     * @since 9
741     */
742    function off(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback?: Callback<MagneticFieldUncalibratedResponse>): void;
743
744    /**
745     * Unsubscribe to orientation sensor data.
746     * @param { SensorId.ORIENTATION } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}.
747     * @param { Callback<OrientationResponse> } callback - callback orientation data.
748     * @throws { BusinessError } 401 - Parameter error.
749     * @syscap SystemCapability.Sensors.Sensor
750     * @since 9
751     */
752    function off(type: SensorId.ORIENTATION, callback?: Callback<OrientationResponse>): void;
753
754    /**
755     * Unsubscribe to pedometer sensor data.
756     * @param { SensorId.PEDOMETER } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER}.
757     * @param { Callback<PedometerResponse> } callback - callback pedometer data.
758     * @throws { BusinessError } 201 - Permission denied.
759     * @throws { BusinessError } 401 - Parameter error.
760     * @permission ohos.permission.ACTIVITY_MOTION
761     * @syscap SystemCapability.Sensors.Sensor
762     * @since 9
763     */
764    function off(type: SensorId.PEDOMETER, callback?: Callback<PedometerResponse>): void;
765
766    /**
767     * Unsubscribe to pedometer detection sensor data.
768     * @param { SensorId.PEDOMETER_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER_DETECTION}.
769     * @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data.
770     * @throws { BusinessError } 201 - Permission denied.
771     * @throws { BusinessError } 401 - Parameter error.
772     * @permission ohos.permission.ACTIVITY_MOTION
773     * @syscap SystemCapability.Sensors.Sensor
774     * @since 9
775     */
776    function off(type: SensorId.PEDOMETER_DETECTION, callback?: Callback<PedometerDetectionResponse>): void;
777
778    /**
779     * Unsubscribe to proximity sensor data.
780     * @param { SensorId.PROXIMITY } type - Indicate the sensor type to listen for, {@code SensorId.PROXIMITY}.
781     * @param { Callback<ProximityResponse> } callback - callback proximity data.
782     * @throws { BusinessError } 401 - Parameter error.
783     * @syscap SystemCapability.Sensors.Sensor
784     * @since 9
785     */
786    function off(type: SensorId.PROXIMITY, callback?: Callback<ProximityResponse>): void;
787
788    /**
789     * Unsubscribe to rotation vector sensor data.
790     * @param { SensorId.ROTATION_VECTOR } type - Indicate the sensor type to listen for, {@code SensorId.ROTATION_VECTOR}.
791     * @param { Callback<RotationVectorResponse> } callback - callback rotation vector data.
792     * @throws { BusinessError } 401 - Parameter error.
793     * @syscap SystemCapability.Sensors.Sensor
794     * @since 9
795     */
796    function off(type: SensorId.ROTATION_VECTOR, callback?: Callback<RotationVectorResponse>): void;
797
798
799    /**
800     * Unsubscribe to significant motion sensor data.
801     * @param { SensorId.SIGNIFICANT_MOTION } type - Indicate the sensor type to listen for, {@code SensorId.SIGNIFICANT_MOTION}.
802     * @param { Callback<SignificantMotionResponse> } callback - callback significant motion data.
803     * @throws { BusinessError } 401 - Parameter error.
804     * @syscap SystemCapability.Sensors.Sensor
805     * @since 9
806     */
807    function off(type: SensorId.SIGNIFICANT_MOTION, callback?: Callback<SignificantMotionResponse>): void;
808
809    /**
810     * Unsubscribe to wear detection sensor data.
811     * @param { SensorId.WEAR_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.WEAR_DETECTION}.
812     * @param { Callback<RotationVectorResponse> } callback - callback wear detection data.
813     * @throws { BusinessError } 401 - Parameter error.
814     * @syscap SystemCapability.Sensors.Sensor
815     * @since 9
816     */
817    function off(type: SensorId.WEAR_DETECTION, callback?: Callback<WearDetectionResponse>): void;
818
819    /**
820     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
821     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}.
822     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
823     * @permission ohos.permission.ACCELEROMETER
824     * @syscap SystemCapability.Sensors.Sensor
825     * @since 8
826     * @deprecated since 9
827     * @useinstead sensor#event:SensorId.ACCELEROMETER
828     */
829    function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<AccelerometerResponse>,
830        options?: Options): void;
831
832    /**
833     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
834     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}.
835     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
836     * @permission ohos.permission.ACCELEROMETER
837     * @syscap SystemCapability.Sensors.Sensor
838     * @since 8
839     * @deprecated since 9
840     * @useinstead sensor#event:SensorId.ACCELEROMETER_UNCALIBRATED
841     */
842    function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>,
843        options?: Options): void;
844
845    /**
846     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
847     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}.
848     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
849     * @syscap SystemCapability.Sensors.Sensor
850     * @since 8
851     * @deprecated since 9
852     * @useinstead sensor#event:SensorId.AMBIENT_LIGHT
853     */
854    function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback<LightResponse>,
855        options?: Options): void;
856
857    /**
858     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
859     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}.
860     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
861     * @syscap SystemCapability.Sensors.Sensor
862     * @since 8
863     * @deprecated since 9
864     * @useinstead sensor#event:SensorId.AMBIENT_TEMPERATURE
865     */
866    function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>,
867        options?: Options): void;
868
869    /**
870     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
871     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_BAROMETER}.
872     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
873     * @syscap SystemCapability.Sensors.Sensor
874     * @since 8
875     * @deprecated since 9
876     * @useinstead sensor#event:SensorId.BAROMETER
877     */
878    function on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback<BarometerResponse>,
879        options?: Options): void;
880
881    /**
882     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
883     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GRAVITY}.
884     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
885     * @syscap SystemCapability.Sensors.Sensor
886     * @since 8
887     * @deprecated since 9
888     * @useinstead sensor#event:SensorId.GRAVITY
889     */
890    function on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback<GravityResponse>,
891        options?: Options): void;
892
893    /**
894     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
895     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}.
896     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
897     * @syscap SystemCapability.Sensors.Sensor
898     * @permission ohos.permission.GYROSCOPE
899     * @since 8
900     * @deprecated since 9
901     * @useinstead sensor#event:SensorId.GYROSCOPE
902     */
903    function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback<GyroscopeResponse>,
904        options?: Options): void;
905
906    /**
907     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
908     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}.
909     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
910     * @syscap SystemCapability.Sensors.Sensor
911     * @permission ohos.permission.GYROSCOPE
912     * @since 8
913     * @deprecated since 9
914     * @useinstead sensor#event:SensorId.GYROSCOPE_UNCALIBRATED
915     */
916    function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>,
917        options?: Options): void;
918
919    /**
920     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
921     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HALL}.
922     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
923     * @syscap SystemCapability.Sensors.Sensor
924     * @since 8
925     * @deprecated since 9
926     * @useinstead sensor#event:SensorId.HALL
927     */
928    function on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback<HallResponse>,
929        options?: Options): void;
930
931    /**
932     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
933     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}.
934     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
935     * @syscap SystemCapability.Sensors.Sensor
936     * @permission ohos.permission.HEALTH_DATA
937     * @since 8
938     * @deprecated since 9
939     * @useinstead sensor#event:SensorId.HEART_RATE
940     */
941    function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRateResponse>,
942        options?: Options): void;
943
944    /**
945     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
946     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}.
947     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
948     * @syscap SystemCapability.Sensors.Sensor
949     * @since 8
950     * @deprecated since 9
951     * @useinstead sensor#event:SensorId.HUMIDITY
952     */
953    function on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback<HumidityResponse>,
954        options?: Options): void;
955
956    /**
957     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
958     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}.
959     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
960     * @syscap SystemCapability.Sensors.Sensor
961     * @permission ohos.permission.ACCELEROMETER
962     * @since 8
963     * @deprecated since 9
964     * @useinstead sensor#event:SensorId.LINEAR_ACCELEROMETER
965     */
966    function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback<LinearAccelerometerResponse>,
967        options?: Options): void;
968
969    /**
970     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
971     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}.
972     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
973     * @syscap SystemCapability.Sensors.Sensor
974     * @since 8
975     * @deprecated since 9
976     * @useinstead sensor#event:SensorId.MAGNETIC_FIELD
977     */
978    function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>,
979        options?: Options): void;
980
981    /**
982     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
983     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}.
984     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
985     * @syscap SystemCapability.Sensors.Sensor
986     * @since 8
987     * @deprecated since 9
988     * @useinstead sensor#event:SensorId.MAGNETIC_FIELD_UNCALIBRATED
989     */
990    function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>,
991        options?: Options): void;
992
993    /**
994     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
995     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}.
996     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
997     * @syscap SystemCapability.Sensors.Sensor
998     * @since 8
999     * @deprecated since 9
1000     * @useinstead sensor#event:SensorId.ORIENTATION
1001     */
1002    function on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback<OrientationResponse>,
1003        options?: Options): void;
1004
1005    /**
1006     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
1007     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}.
1008     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
1009     * @syscap SystemCapability.Sensors.Sensor
1010     * @permission ohos.permission.ACTIVITY_MOTION
1011     * @since 8
1012     * @deprecated since 9
1013     * @useinstead sensor#event:SensorId.PEDOMETER
1014     */
1015    function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback<PedometerResponse>,
1016        options?: Options): void;
1017
1018    /**
1019     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
1020     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}.
1021     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
1022     * @syscap SystemCapability.Sensors.Sensor
1023     * @permission ohos.permission.ACTIVITY_MOTION
1024     * @since 8
1025     * @deprecated since 9
1026     * @useinstead sensor#event:SensorId.PEDOMETER_DETECTION
1027     */
1028    function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>,
1029        options?: Options): void;
1030
1031    /**
1032     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
1033     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}.
1034     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
1035     * @syscap SystemCapability.Sensors.Sensor
1036     * @since 8
1037     * @deprecated since 9
1038     * @useinstead sensor#event:SensorId.PROXIMITY
1039     */
1040    function on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback<ProximityResponse>,
1041        options?: Options): void;
1042
1043    /**
1044     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
1045     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}.
1046     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
1047     * @syscap SystemCapability.Sensors.Sensor
1048     * @since 8
1049     * @deprecated since 9
1050     * @useinstead sensor#event:SensorId.ROTATION_VECTOR
1051     */
1052    function on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback<RotationVectorResponse>,
1053        options?: Options): void;
1054
1055    /**
1056     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
1057     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}.
1058     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
1059     * @syscap SystemCapability.Sensors.Sensor
1060     * @since 8
1061     * @deprecated since 9
1062     * @useinstead sensor#event:SensorId.SIGNIFICANT_MOTION
1063     */
1064    function on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>,
1065        options?: Options): void;
1066
1067    /**
1068     * Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
1069     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}.
1070     * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
1071     * @syscap SystemCapability.Sensors.Sensor
1072     * @since 8
1073     * @deprecated since 9
1074     * @useinstead sensor#event:SensorId.WEAR_DETECTION
1075     */
1076    function on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback<WearDetectionResponse>,
1077        options?: Options): void;
1078
1079    /**
1080     * Subscribe to sensor data once.
1081     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}.
1082     * @syscap SystemCapability.Sensors.Sensor
1083     * @permission ohos.permission.ACCELEROMETER
1084     * @since 8
1085     * @deprecated since 9
1086     * @useinstead sensor#event:SensorId.ACCELEROMETER
1087     */
1088    function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<AccelerometerResponse>): void;
1089
1090    /**
1091     * Subscribe to sensor data once.
1092     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}.
1093     * @syscap SystemCapability.Sensors.Sensor
1094     * @permission ohos.permission.ACCELEROMETER
1095     * @since 8
1096     * @deprecated since 9
1097     * @useinstead sensor#event:SensorId.ACCELEROMETER_UNCALIBRATED
1098     */
1099    function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>): void;
1100
1101    /**
1102     * Subscribe to sensor data once.
1103     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}.
1104     * @syscap SystemCapability.Sensors.Sensor
1105     * @since 8
1106     * @deprecated since 9
1107     * @useinstead sensor#event:SensorId.AMBIENT_LIGHT
1108     */
1109    function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback<LightResponse>): void;
1110
1111    /**
1112     * Subscribe to sensor data once.
1113     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}.
1114     * @syscap SystemCapability.Sensors.Sensor
1115     * @since 8
1116     * @deprecated since 9
1117     * @useinstead sensor#event:SensorId.AMBIENT_TEMPERATURE
1118     */
1119    function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>): void;
1120
1121    /**
1122     * Subscribe to sensor data once.
1123     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_BAROMETER}.
1124     * @syscap SystemCapability.Sensors.Sensor
1125     * @since 8
1126     * @deprecated since 9
1127     * @useinstead sensor#event:SensorId.BAROMETER
1128     */
1129    function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback<BarometerResponse>): void;
1130
1131    /**
1132     * Subscribe to sensor data once.
1133     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GRAVITY}.
1134     * @syscap SystemCapability.Sensors.Sensor
1135     * @since 8
1136     * @deprecated since 9
1137     * @useinstead sensor#event:SensorId.GRAVITY
1138     */
1139    function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback<GravityResponse>): void;
1140
1141    /**
1142     * Subscribe to sensor data once.
1143     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}.
1144     * @syscap SystemCapability.Sensors.Sensor
1145     * @permission ohos.permission.GYROSCOPE
1146     * @since 8
1147     * @deprecated since 9
1148     * @useinstead sensor#event:SensorId.GYROSCOPE
1149     */
1150    function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback<GyroscopeResponse>): void;
1151
1152    /**
1153     * Subscribe to sensor data once.
1154     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}.
1155     * @syscap SystemCapability.Sensors.Sensor
1156     * @permission ohos.permission.GYROSCOPE
1157     * @since 8
1158     * @deprecated since 9
1159     * @useinstead sensor#event:SensorId.GYROSCOPE_UNCALIBRATED
1160     */
1161    function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>): void;
1162
1163    /**
1164     * Subscribe to sensor data once.
1165     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HALL}.
1166     * @syscap SystemCapability.Sensors.Sensor
1167     * @since 8
1168     * @deprecated since 9
1169     * @useinstead sensor#event:SensorId.HALL
1170     */
1171    function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback<HallResponse>): void;
1172
1173    /**
1174     * Subscribe to sensor data once.
1175     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}.
1176     * @syscap SystemCapability.Sensors.Sensor
1177     * @permission ohos.permission.HEART_RATE
1178     * @since 8
1179     * @deprecated since 9
1180     * @useinstead sensor#event:SensorId.HEART_RATE
1181     */
1182    function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRateResponse>): void;
1183
1184    /**
1185     * Subscribe to sensor data once.
1186     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}.
1187     * @syscap SystemCapability.Sensors.Sensor
1188     * @since 8
1189     * @deprecated since 9
1190     * @useinstead sensor#event:SensorId.HUMIDITY
1191     */
1192    function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback<HumidityResponse>): void;
1193
1194    /**
1195     * Subscribe to sensor data once.
1196     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}.
1197     * @syscap SystemCapability.Sensors.Sensor
1198     * @permission ohos.permission.ACCELERATION
1199     * @since 8
1200     * @deprecated since 9
1201     * @useinstead sensor#event:SensorId.LINEAR_ACCELEROMETER
1202     */
1203    function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback<LinearAccelerometerResponse>): void;
1204
1205    /**
1206     * Subscribe to sensor data once.
1207     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}.
1208     * @syscap SystemCapability.Sensors.Sensor
1209     * @since 8
1210     * @deprecated since 9
1211     * @useinstead sensor#event:SensorId.MAGNETIC_FIELD
1212     */
1213    function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>): void;
1214
1215    /**
1216     * Subscribe to sensor data once.
1217     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}.
1218     * @syscap SystemCapability.Sensors.Sensor
1219     * @since 8
1220     * @deprecated since 9
1221     * @useinstead sensor#event:SensorId.MAGNETIC_FIELD_UNCALIBRATED
1222     */
1223    function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>): void;
1224
1225    /**
1226     * Subscribe to sensor data once.
1227     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}.
1228     * @syscap SystemCapability.Sensors.Sensor
1229     * @since 8
1230     * @deprecated since 9
1231     * @useinstead sensor#event:SensorId.ORIENTATION
1232     */
1233    function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback<OrientationResponse>): void;
1234
1235    /**
1236     * Subscribe to sensor data once.
1237     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}.
1238     * @syscap SystemCapability.Sensors.Sensor
1239     * @permission ohos.permission.ACTIVITY_MOTION
1240     * @since 8
1241     * @deprecated since 9
1242     * @useinstead sensor#event:SensorId.PEDOMETER
1243     */
1244    function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback<PedometerResponse>): void;
1245
1246    /**
1247     * Subscribe to sensor data once.
1248     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}.
1249     * @syscap SystemCapability.Sensors.Sensor
1250     * @permission ohos.permission.ACTIVITY_MOTION
1251     * @since 8
1252     * @deprecated since 9
1253     * @useinstead sensor#event:SensorId.PEDOMETER_DETECTION
1254     */
1255    function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>): void;
1256
1257    /**
1258     * Subscribe to sensor data once.
1259     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}.
1260     * @syscap SystemCapability.Sensors.Sensor
1261     * @since 8
1262     * @deprecated since 9
1263     * @useinstead sensor#event:SensorId.PROXIMITY
1264     */
1265    function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback<ProximityResponse>): void;
1266
1267    /**
1268     * Subscribe to sensor data once.
1269     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}.
1270     * @syscap SystemCapability.Sensors.Sensor
1271     * @since 8
1272     * @deprecated since 9
1273     * @useinstead sensor#event:SensorId.ROTATION_VECTOR
1274     */
1275    function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback<RotationVectorResponse>): void;
1276
1277    /**
1278     * Subscribe to sensor data once.
1279     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}.
1280     * @syscap SystemCapability.Sensors.Sensor
1281     * @since 8
1282     * @deprecated since 9
1283     * @useinstead sensor#event:SensorId.SIGNIFICANT_MOTION
1284     */
1285    function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>): void;
1286
1287    /**
1288     * Subscribe to sensor data once.
1289     * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}.
1290     * @syscap SystemCapability.Sensors.Sensor
1291     * @since 8
1292     * @deprecated since 9
1293     * @useinstead sensor#event:SensorId.WEAR_DETECTION
1294     */
1295    function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback<WearDetectionResponse>): void;
1296
1297    /**
1298     * Unsubscribe to sensor data.
1299     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}.
1300     * @permission ohos.permission.ACCELEROMETER
1301     * @syscap SystemCapability.Sensors.Sensor
1302     * @since 8
1303     * @deprecated since 9
1304     * @useinstead sensor#event:SensorId.ACCELEROMETER
1305     */
1306     function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback?: Callback<AccelerometerResponse>): void;
1307
1308    /**
1309     * Unsubscribe to sensor data.
1310     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}.
1311     * @permission ohos.permission.ACCELEROMETER
1312     * @syscap SystemCapability.Sensors.Sensor
1313     * @since 8
1314     * @deprecated since 9
1315     * @useinstead sensor#event:SensorId.ACCELEROMETER_UNCALIBRATED
1316     */
1317    function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,
1318        callback?: Callback<AccelerometerUncalibratedResponse>): void;
1319
1320    /**
1321     * Unsubscribe to sensor data.
1322     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}.
1323     * @syscap SystemCapability.Sensors.Sensor
1324     * @since 8
1325     * @deprecated since 9
1326     * @useinstead sensor#event:SensorId.AMBIENT_LIGHT
1327     */
1328    function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback?: Callback<LightResponse>): void;
1329
1330    /**
1331     * Unsubscribe to sensor data.
1332     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}.
1333     * @syscap SystemCapability.Sensors.Sensor
1334     * @since 8
1335     * @deprecated since 9
1336     * @useinstead sensor#event:SensorId.AMBIENT_TEMPERATURE
1337     */
1338    function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback?: Callback<AmbientTemperatureResponse>): void;
1339
1340    /**
1341     * Unsubscribe to sensor data.
1342     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_BAROMETER}.
1343     * @syscap SystemCapability.Sensors.Sensor
1344     * @since 8
1345     * @deprecated since 9
1346     * @useinstead sensor#event:SensorId.BAROMETER
1347     */
1348    function off(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback?: Callback<BarometerResponse>): void;
1349
1350    /**
1351     * Unsubscribe to sensor data.
1352     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_GRAVITY}.
1353     * @syscap SystemCapability.Sensors.Sensor
1354     * @since 8
1355     * @deprecated since 9
1356     * @useinstead sensor#event:SensorId.GRAVITY
1357     */
1358    function off(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback?: Callback<GravityResponse>): void;
1359
1360    /**
1361     * Unsubscribe to sensor data.
1362     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}.
1363     * @syscap SystemCapability.Sensors.Sensor
1364     * @permission ohos.permission.GYROSCOPE
1365     * @since 8
1366     * @deprecated since 9
1367     * @useinstead sensor#event:SensorId.GYROSCOPE
1368     */
1369    function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback?: Callback<GyroscopeResponse>): void;
1370
1371    /**
1372     * Unsubscribe to sensor data.
1373     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}.
1374     * @syscap SystemCapability.Sensors.Sensor
1375     * @permission ohos.permission.GYROSCOPE
1376     * @since 8
1377     * @deprecated since 9
1378     * @useinstead sensor#event:SensorId.GYROSCOPE_UNCALIBRATED
1379     */
1380    function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback<GyroscopeUncalibratedResponse>): void;
1381
1382    /**
1383     * Unsubscribe to sensor data.
1384     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_HALL}.
1385     * @syscap SystemCapability.Sensors.Sensor
1386     * @since 8
1387     * @deprecated since 9
1388     * @useinstead sensor#event:SensorId.HALL
1389     */
1390    function off(type: SensorType.SENSOR_TYPE_ID_HALL, callback?: Callback<HallResponse>): void;
1391
1392    /**
1393     * Unsubscribe to sensor data.
1394     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}.
1395     * @syscap SystemCapability.Sensors.Sensor
1396     * @permission ohos.permission.HEALTH_DATA
1397     * @since 8
1398     * @deprecated since 9
1399     * @useinstead sensor#event:SensorId.HEART_RATE
1400     */
1401    function off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback<HeartRateResponse>): void;
1402
1403    /**
1404     * Unsubscribe to sensor data.
1405     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}.
1406     * @syscap SystemCapability.Sensors.Sensor
1407     * @since 8
1408     * @deprecated since 9
1409     * @useinstead sensor#event:SensorId.HUMIDITY
1410     */
1411    function off(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback?: Callback<HumidityResponse>): void;
1412
1413    /**
1414     * Unsubscribe to sensor data.
1415     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}.
1416     * @syscap SystemCapability.Sensors.Sensor
1417     * @permission ohos.permission.ACCELEROMETER
1418     * @since 8
1419     * @deprecated since 9
1420     * @useinstead sensor#event:SensorId.LINEAR_ACCELEROMETER
1421     */
1422    function off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback<LinearAccelerometerResponse>): void;
1423
1424    /**
1425     * Unsubscribe to sensor data.
1426     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}.
1427     * @syscap SystemCapability.Sensors.Sensor
1428     * @since 8
1429     * @deprecated since 9
1430     * @useinstead sensor#event:SensorId.MAGNETIC_FIELD
1431     */
1432    function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback?: Callback<MagneticFieldResponse>): void;
1433
1434    /**
1435     * Unsubscribe to sensor data.
1436     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}.
1437     * @syscap SystemCapability.Sensors.Sensor
1438     * @since 8
1439     * @deprecated since 9
1440     * @useinstead sensor#event:SensorId.MAGNETIC_FIELD_UNCALIBRATED
1441     */
1442    function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback?: Callback<MagneticFieldUncalibratedResponse>): void;
1443
1444    /**
1445     * Unsubscribe to sensor data.
1446     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}.
1447     * @syscap SystemCapability.Sensors.Sensor
1448     * @since 8
1449     * @deprecated since 9
1450     * @useinstead sensor#event:SensorId.ORIENTATION
1451     */
1452    function off(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback?: Callback<OrientationResponse>): void;
1453
1454    /**
1455     * Unsubscribe to sensor data.
1456     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}.
1457     * @syscap SystemCapability.Sensors.Sensor
1458     * @permission ohos.permission.ACTIVITY_MOTION
1459     * @since 8
1460     * @deprecated since 9
1461     * @useinstead sensor#event:SensorId.PEDOMETER
1462     */
1463    function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback?: Callback<PedometerResponse>): void;
1464
1465    /**
1466     * Unsubscribe to sensor data.
1467     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}.
1468     * @syscap SystemCapability.Sensors.Sensor
1469     * @permission ohos.permission.ACTIVITY_MOTION
1470     * @since 8
1471     * @deprecated since 9
1472     * @useinstead sensor#event:SensorId.PEDOMETER_DETECTION
1473     */
1474    function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback?: Callback<PedometerDetectionResponse>): void;
1475
1476    /**
1477     * Unsubscribe to sensor data.
1478     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}.
1479     * @syscap SystemCapability.Sensors.Sensor
1480     * @since 8
1481     * @deprecated since 9
1482     * @useinstead sensor#event:SensorId.PROXIMITY
1483     */
1484    function off(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback?: Callback<ProximityResponse>): void;
1485
1486    /**
1487     * Unsubscribe to sensor data.
1488     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}.
1489     * @syscap SystemCapability.Sensors.Sensor
1490     * @since 8
1491     * @deprecated since 9
1492     * @useinstead sensor#event:SensorId.ROTATION_VECTOR
1493     */
1494    function off(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback?: Callback<RotationVectorResponse>): void;
1495
1496    /**
1497     * Unsubscribe to sensor data.
1498     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}.
1499     * @syscap SystemCapability.Sensors.Sensor
1500     * @since 8
1501     * @deprecated since 9
1502     * @useinstead sensor#event:SensorId.SIGNIFICANT_MOTION
1503     */
1504    function off(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback?: Callback<SignificantMotionResponse>): void;
1505
1506    /**
1507     * Unsubscribe to sensor data.
1508     * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}.
1509     * @syscap SystemCapability.Sensors.Sensor
1510     * @since 8
1511     * @deprecated since 9
1512     * @useinstead sensor#event:SensorId.WEAR_DETECTION
1513     */
1514    function off(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback?: Callback<WearDetectionResponse>): void;
1515
1516    /**
1517     * Indicates sensor information.
1518     * @syscap SystemCapability.Sensors.Sensor
1519     * @since 9
1520     */
1521    interface Sensor {
1522        sensorName:string; /**< Sensor name */
1523        vendorName:string; /**< Sensor vendor */
1524        firmwareVersion:string; /**< Sensor firmware version */
1525        hardwareVersion:string; /**< Sensor hardware version */
1526        sensorId:number; /**< Sensor type ID, {@code SensorType} */
1527        maxRange:number; /**< Maximum measurement range of the sensor */
1528        minSamplePeriod:number; /**< Minimum sample period allowed, in ns */
1529        maxSamplePeriod:number; /**< maximum sample period allowed, in ns */
1530        precision:number; /**< Sensor accuracy */
1531        power:number; /**< Sensor power */
1532    }
1533
1534    /**
1535     * Obtains the sensor information of a specified type.
1536     * @param type Indicate the sensor type, {@code SensorId}.
1537     * @param { AsyncCallback<Sensor> } callback - callback sensor info.
1538     * @throws { BusinessError } 401 - Parameter error.
1539     * @throws { BusinessError } 14500101 - Service exception.
1540     * @syscap SystemCapability.Sensors.Sensor
1541     * @since 9
1542     */
1543    function getSingleSensor(type: SensorId, callback: AsyncCallback<Sensor>): void;
1544
1545    /**
1546     * Obtains the sensor information of a specified type.
1547     * @param type Indicate the sensor type, {@code SensorId}.
1548     * @returns { Promise<Sensor> } Promise used to return the result.
1549     * @throws { BusinessError } 401 - Parameter error.
1550     * @throws { BusinessError } 14500101 - Service exception.
1551     * @syscap SystemCapability.Sensors.Sensor
1552     * @since 9
1553     */
1554    function getSingleSensor(type: SensorId): Promise<Sensor>;
1555
1556    /**
1557     * Obtains all sensor information on the device.
1558     * @param type Indicate the sensor type, {@code SensorId}.
1559     * @param { AsyncCallback<Array<Sensor>> } callback - callback sensor list.
1560     * @throws { BusinessError } 401 - Parameter error.
1561     * @throws { BusinessError } 14500101 - Service exception.
1562     * @syscap SystemCapability.Sensors.Sensor
1563     * @since 9
1564     */
1565    function getSensorList(callback: AsyncCallback<Array<Sensor>>): void;
1566
1567    /**
1568     * Obtains all sensor information on the device.
1569     * @param type Indicate the sensor type, {@code SensorId}.
1570     * @returns { Promise<Array<Sensor>> } Promise used to return the result.
1571     * @throws { BusinessError } 401 - Parameter error.
1572     * @throws { BusinessError } 14500101 - Service exception.
1573     * @syscap SystemCapability.Sensors.Sensor
1574     * @since 9
1575     */
1576    function getSensorList(): Promise<Array<Sensor>>;
1577
1578    /**
1579     * Indicates geomagnetic field data.
1580     * @syscap SystemCapability.Sensors.Sensor
1581     * @since 8
1582     */
1583    interface GeomagneticResponse {
1584        x: number;
1585        y: number;
1586        z: number;
1587        geomagneticDip: number;
1588        deflectionAngle: number;
1589        levelIntensity: number;
1590        totalIntensity: number;
1591    }
1592
1593    /**
1594     * Indicates geographic location.
1595     * @syscap SystemCapability.Sensors.Sensor
1596     * @since 8
1597     */
1598    interface LocationOptions {
1599        latitude: number;
1600        longitude: number;
1601        altitude: number;
1602    }
1603
1604   /**
1605     * Implements the calculation of the geomagnetic field at a specific location on Earth.
1606     *
1607     * @param LocationOptions Indicates geographic location, {@code LocationOptions}.
1608     * @param timeMillis Indicates the time at which the magnetic declination is to be obtained, in milliseconds
1609     * since the Unix epoch.
1610     * @returns Returns the geomagnetic field data, {@code GeomagneticResponse}.
1611     * @syscap SystemCapability.Sensors.Sensor
1612     * @since 8
1613     * @deprecated since 9
1614     * @useinstead sensor#getGeomagneticInfo
1615     */
1616    function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback<GeomagneticResponse>): void;
1617    function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise<GeomagneticResponse>;
1618
1619    /**
1620     * Obtains the geomagnetic field at a specific location on the Earth.
1621     * @param LocationOptions Indicates geographic location, {@code LocationOptions}.
1622     * @param timeMillis Indicates the time at which the magnetic declination is to be obtained, in milliseconds
1623     * since the Unix epoch.
1624     * @param { AsyncCallback<GeomagneticResponse> } callback - callback geomagnetic field.
1625     * @throws { BusinessError } 401 - Parameter error.
1626     * @throws { BusinessError } 14500101 - Service exception.
1627     * @syscap SystemCapability.Sensors.Sensor
1628     * @since 9
1629     */
1630    function getGeomagneticInfo(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback<GeomagneticResponse>): void;
1631
1632    /**
1633     * Obtains the geomagnetic field at a specific location on the Earth.
1634     * @param LocationOptions Indicates geographic location, {@code LocationOptions}.
1635     * @param timeMillis Indicates the time at which the magnetic declination is to be obtained, in milliseconds
1636     * since the Unix epoch.
1637     * @returns { Promise<GeomagneticResponse> } Promise used to return the result.
1638     * @throws { BusinessError } 401 - Parameter error.
1639     * @throws { BusinessError } 14500101 - Service exception.
1640     * @syscap SystemCapability.Sensors.Sensor
1641     * @since 9
1642     */
1643    function getGeomagneticInfo(locationOptions: LocationOptions, timeMillis: number): Promise<GeomagneticResponse>;
1644
1645   /**
1646     * Obtains the altitude at which the device is located based on the current atmospheric pressure.
1647     *
1648     * @param seaPressure Indicates the sea level pressure, in hPa.
1649     * @param currentPressure Indicates the atmospheric pressure measured by the barometer, in hPa.
1650     * @returns Returns the altitude in meters at which the device is located.
1651     * @syscap SystemCapability.Sensors.Sensor
1652     * @since 8
1653     * @deprecated since 9
1654     * @useinstead sensor#getDeviceAltitude
1655     */
1656    function getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback<number>): void;
1657    function getAltitude(seaPressure: number, currentPressure: number): Promise<number>;
1658
1659    /**
1660     * Obtains the altitude at which the device is located based on the current atmospheric pressure.
1661     * @param seaPressure Indicates the sea level pressure, in hPa.
1662     * @param currentPressure Indicates the atmospheric pressure measured by the barometer, in hPa.
1663     * @param { AsyncCallback<number> } callback - callback device altitude.
1664     * @throws { BusinessError } 401 - Parameter error.
1665     * @throws { BusinessError } 14500101 - Service exception.
1666     * @syscap SystemCapability.Sensors.Sensor
1667     * @since 9
1668     */
1669    function getDeviceAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback<number>): void;
1670
1671    /**
1672     * Obtains the altitude at which the device is located based on the current atmospheric pressure.
1673     * @param seaPressure Indicates the sea level pressure, in hPa.
1674     * @param currentPressure Indicates the atmospheric pressure measured by the barometer, in hPa.
1675     * @returns { Promise<number> } Promise used to return the result.
1676     * @throws { BusinessError } 401 - Parameter error.
1677     * @throws { BusinessError } 14500101 - Service exception.
1678     * @syscap SystemCapability.Sensors.Sensor
1679     * @since 9
1680     */
1681    function getDeviceAltitude(seaPressure: number, currentPressure: number): Promise<number>;
1682
1683    /**
1684     * Computes the geomagnetic inclination angle in radians from the inclination matrix.
1685     *
1686     * @param inclinationMatrix Indicates the inclination matrix.
1687     * @returns Returns the geomagnetic inclination angle in radians.
1688     * @syscap SystemCapability.Sensors.Sensor
1689     * @since 8
1690     * @deprecated since 9
1691     * @useinstead sensor#getInclination
1692     */
1693    function getGeomagneticDip(inclinationMatrix: Array<number>, callback: AsyncCallback<number>): void;
1694    function getGeomagneticDip(inclinationMatrix: Array<number>): Promise<number>;
1695
1696    /**
1697     * Computes the geomagnetic inclination in radians from the inclination matrix.
1698     * @param inclinationMatrix Indicates the inclination matrix.
1699     * @param { AsyncCallback<number> } callback - callback inclination in radians.
1700     * @throws { BusinessError } 401 - Parameter error.
1701     * @throws { BusinessError } 14500101 - Service exception.
1702     * @syscap SystemCapability.Sensors.Sensor
1703     * @since 9
1704     */
1705    function getInclination(inclinationMatrix: Array<number>, callback: AsyncCallback<number>): void;
1706
1707    /**
1708     * Computes the geomagnetic inclination in radians from the inclination matrix.
1709     * @param inclinationMatrix Indicates the inclination matrix.
1710     * @returns { Promise<number> } Promise used to return the result.
1711     * @throws { BusinessError } 401 - Parameter error.
1712     * @throws { BusinessError } 14500101 - Service exception.
1713     * @syscap SystemCapability.Sensors.Sensor
1714     * @since 9
1715     */
1716    function getInclination(inclinationMatrix: Array<number>): Promise<number>;
1717
1718    /**
1719     * Get the angle change between two rotation matrices
1720     *
1721     * @param currentRotationMatrix Indicates the current rotation matrix.
1722     * @param preRotationMatrix Indicates the current rotation matrix.
1723     * @returns Returns the array of number(z, x and y) in which the angle variety.
1724     * @syscap SystemCapability.Sensors.Sensor
1725     * @since 8
1726     * @deprecated since 9
1727     * @useinstead sensor#getAngleVariation
1728     */
1729    function getAngleModify(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>,
1730        callback: AsyncCallback<Array<number>>): void;
1731    function getAngleModify(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise<Array<number>>;
1732
1733    /**
1734     * Get the angle variation between two rotation matrices.
1735     * @param currentRotationMatrix Indicates the current rotation matrix.
1736     * @param preRotationMatrix Indicates the current rotation matrix.
1737     * @param { AsyncCallback<Array<number>> } callback - callback angle variation.
1738     * @throws { BusinessError } 401 - Parameter error.
1739     * @throws { BusinessError } 14500101 - Service exception.
1740     * @syscap SystemCapability.Sensors.Sensor
1741     * @since 9
1742     */
1743    function getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>,
1744        callback: AsyncCallback<Array<number>>): void;
1745
1746    /**
1747     * Get the angle variation between two rotation matrices.
1748     * @param currentRotationMatrix Indicates the current rotation matrix.
1749     * @param preRotationMatrix Indicates the current rotation matrix.
1750     * @returns { Promise<Array<number>> } Promise used to return the result.
1751     * @throws { BusinessError } 401 - Parameter error.
1752     * @throws { BusinessError } 14500101 - Service exception.
1753     * @syscap SystemCapability.Sensors.Sensor
1754     * @since 9
1755     */
1756    function getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise<Array<number>>;
1757
1758    /**
1759     * Convert rotation vector to rotation matrix.
1760     *
1761     * @param rotationVector Indicates the rotation vector.
1762     * @returns Returns the rotation matrix.
1763     * @syscap SystemCapability.Sensors.Sensor
1764     * @since 8
1765     * @deprecated since 9
1766     * @useinstead sensor#getRotationMatrix
1767     */
1768    function createRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void;
1769    function createRotationMatrix(rotationVector: Array<number>): Promise<Array<number>>;
1770
1771    /**
1772     * Convert rotation vector to rotation matrix.
1773     * @param rotationVector Indicates the rotation vector.
1774     * @param { AsyncCallback<Array<number>> } callback - callback rotation matrix.
1775     * @throws { BusinessError } 401 - Parameter error.
1776     * @throws { BusinessError } 14500101 - Service exception.
1777     * @syscap SystemCapability.Sensors.Sensor
1778     * @since 9
1779     */
1780    function getRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void;
1781
1782    /**
1783     * Convert rotation vector to rotation matrix.
1784     * @param rotationVector Indicates the rotation vector.
1785     * @returns { Promise<Array<number>> } Promise used to return the result.
1786     * @throws { BusinessError } 401 - Parameter error.
1787     * @throws { BusinessError } 14500101 - Service exception.
1788     * @syscap SystemCapability.Sensors.Sensor
1789     * @since 9
1790     */
1791    function getRotationMatrix(rotationVector: Array<number>): Promise<Array<number>>;
1792
1793    /**
1794     * Indicates the axis of the new coordinate system that coincides with the XY axis of the
1795     * original coordinate system.
1796     * @syscap SystemCapability.Sensors.Sensor
1797     * @since 8
1798     */
1799    interface CoordinatesOptions {
1800        /** Indicates the axis of the new coordinate system that coincides with the X axis of
1801         * the original coordinate system.
1802         */
1803        x: number;
1804        /** Indicates the axis of the new coordinate system that coincides with the Z axis of
1805         * the original coordinate system.
1806         */
1807        y: number;
1808    }
1809
1810    /**
1811     * Rotate the provided rotation matrix so that it can be represented in a different way
1812     * Coordinate System
1813     * @param inRotationVector Indicates the rotation matrix to be transformed.
1814     * @param coordinates Indicates coordinate system guidance, {@code CoordinatesOptions}.
1815     * @returns Returns the transformed rotation matrix.
1816     * @syscap SystemCapability.Sensors.Sensor
1817     * @since 8
1818     * @deprecated since 9
1819     * @useinstead sensor#transformRotationMatrix
1820     */
1821    function transformCoordinateSystem(inRotationVector: Array<number>, coordinates: CoordinatesOptions,
1822        callback: AsyncCallback<Array<number>>): void;
1823    function transformCoordinateSystem(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise<Array<number>>;
1824
1825    /**
1826     * Rotate the provided rotation matrix so that it can be represented in a different way coordinate System.
1827     * @param inRotationVector Indicates the rotation matrix to be transformed.
1828     * @param coordinates Indicates coordinate system guidance, {@code CoordinatesOptions}.
1829     * @param { AsyncCallback<Array<number>> } callback - callback rotation matrix.
1830     * @throws { BusinessError } 401 - Parameter error.
1831     * @throws { BusinessError } 14500101 - Service exception.
1832     * @syscap SystemCapability.Sensors.Sensor
1833     * @since 9
1834     */
1835    function transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions,
1836        callback: AsyncCallback<Array<number>>): void;
1837
1838    /**
1839     * Rotate the provided rotation matrix so that it can be represented in a different way coordinate System.
1840     * @param inRotationVector Indicates the rotation matrix to be transformed.
1841     * @param coordinates Indicates coordinate system guidance, {@code CoordinatesOptions}.
1842     * @returns { Promise<Array<number>> } Promise used to return the result.
1843     * @throws { BusinessError } 401 - Parameter error.
1844     * @throws { BusinessError } 14500101 - Service exception.
1845     * @syscap SystemCapability.Sensors.Sensor
1846     * @since 9
1847     */
1848    function transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise<Array<number>>;
1849
1850    /**
1851     * convert a rotation vector to a normalized quaternion.
1852     *
1853     * @param rotationVector Indicates the rotation vector.
1854     * @returns Returns the normalized quaternion.
1855     * @syscap SystemCapability.Sensors.Sensor
1856     * @since 8
1857     * @deprecated since 9
1858     * @useinstead sensor#getQuaternion
1859     */
1860    function createQuaternion(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void;
1861    function createQuaternion(rotationVector: Array<number>): Promise<Array<number>>;
1862
1863    /**
1864     * convert a rotation vector to a normalized quaternion.
1865     * @param rotationVector Indicates the rotation vector.
1866     * @param { AsyncCallback<Array<number>> } callback - callback a normalized quaternion.
1867     * @throws { BusinessError } 401 - Parameter error.
1868     * @throws { BusinessError } 14500101 - Service exception.
1869     * @syscap SystemCapability.Sensors.Sensor
1870     * @since 9
1871     */
1872    function getQuaternion(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void;
1873
1874    /**
1875     * convert a rotation vector to a normalized quaternion.
1876     * @param rotationVector Indicates the rotation vector.
1877     * @returns { Promise<Array<number>> } Promise used to return the result.
1878     * @throws { BusinessError } 401 - Parameter error.
1879     * @throws { BusinessError } 14500101 - Service exception.
1880     * @syscap SystemCapability.Sensors.Sensor
1881     * @since 9
1882     */
1883    function getQuaternion(rotationVector: Array<number>): Promise<Array<number>>;
1884
1885    /**
1886     * Computes the device's orientation based on the rotation matrix.
1887     *
1888     * @param rotationMatrix Indicates the rotation matrix.
1889     * @returns Returns the array is the angle of rotation around the z, x, y axis.
1890     * @syscap SystemCapability.Sensors.Sensor
1891     * @since 8
1892     * @deprecated since 9
1893     * @useinstead sensor#getOrientation
1894     */
1895    function getDirection(rotationMatrix: Array<number>, callback: AsyncCallback<Array<number>>): void;
1896    function getDirection(rotationMatrix: Array<number>): Promise<Array<number>>;
1897
1898    /**
1899     * Computes the device's orientation based on the rotation matrix.
1900     * @param rotationMatrix Indicates the rotation matrix.
1901     * @param { AsyncCallback<Array<number>> } callback - callback the angle of rotation around the z, x, y axis.
1902     * @throws { BusinessError } 401 - Parameter error.
1903     * @throws { BusinessError } 14500101 - Service exception.
1904     * @syscap SystemCapability.Sensors.Sensor
1905     * @since 9
1906     */
1907    function getOrientation(rotationMatrix: Array<number>, callback: AsyncCallback<Array<number>>): void;
1908
1909    /**
1910     * Computes the device's orientation based on the rotation matrix.
1911     * @param rotationMatrix Indicates the rotation matrix.
1912     * @returns { Promise<Array<number>> } Promise used to return the result.
1913     * @throws { BusinessError } 401 - Parameter error.
1914     * @throws { BusinessError } 14500101 - Service exception.
1915     * @syscap SystemCapability.Sensors.Sensor
1916     * @since 9
1917     */
1918    function getOrientation(rotationMatrix: Array<number>): Promise<Array<number>>;
1919
1920    /**
1921     * Indicates the response of rotation matrix.
1922     * @syscap SystemCapability.Sensors.Sensor
1923     * @since 8
1924     */
1925    interface RotationMatrixResponse {
1926        rotation: Array<number>;
1927        inclination: Array<number>
1928    }
1929
1930    /**
1931     * Calculate rotation matrix based on gravity vector and geomagnetic vector.
1932     *
1933     * @param gravity Indicates the gravity vector.
1934     * @param geomagnetic Indicates the geomagnetic vector.
1935     * @returns Returns the rotation matrix, {@code RotationMatrixResponse}.
1936     * @syscap SystemCapability.Sensors.Sensor
1937     * @since 8
1938     * @deprecated since 9
1939     * @useinstead sensor#getRotationMatrix
1940     */
1941    function createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>, callback: AsyncCallback<RotationMatrixResponse>): void;
1942    function createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>,): Promise<RotationMatrixResponse>;
1943
1944    /**
1945     * Calculate rotation matrix based on gravity vector and geomagnetic vector.
1946     * @param gravity Indicates the gravity vector.
1947     * @param geomagnetic Indicates the geomagnetic vector.
1948     * @param { AsyncCallback<Array<RotationMatrixResponse>> } callback - callback rotation matrix and inclination matrix.
1949     * @throws { BusinessError } 401 - Parameter error.
1950     * @throws { BusinessError } 14500101 - Service exception.
1951     * @syscap SystemCapability.Sensors.Sensor
1952     * @since 9
1953     */
1954     function getRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>, callback: AsyncCallback<RotationMatrixResponse>): void;
1955
1956    /**
1957     * Calculate rotation matrix based on gravity vector and geomagnetic vector.
1958     * @param gravity Indicates the gravity vector.
1959     * @param geomagnetic Indicates the geomagnetic vector.
1960     * @returns { Promise<RotationMatrixResponse> } Promise used to return the result.
1961     * @throws { BusinessError } 401 - Parameter error.
1962     * @throws { BusinessError } 14500101 - Service exception.
1963     * @syscap SystemCapability.Sensors.Sensor
1964     * @since 9
1965     */
1966     function getRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>): Promise<RotationMatrixResponse>;
1967
1968    /**
1969     * Subscribe to the sensor's optional parameters.
1970     * @syscap SystemCapability.Sensors.Sensor
1971     * @since 8
1972     */
1973    interface Options {
1974        interval?: number; /**< Sensor event reporting event interval */
1975    }
1976
1977    /**
1978     * The type of number.
1979     * @syscap SystemCapability.Sensors.Sensor
1980     * @since 8
1981     * @deprecated since 9
1982     * @useinstead sensor.SensorId
1983     */
1984    enum SensorType {
1985        SENSOR_TYPE_ID_ACCELEROMETER = 1,          /**< Acceleration sensor */
1986        SENSOR_TYPE_ID_GYROSCOPE = 2,              /**< Gyroscope sensor */
1987        SENSOR_TYPE_ID_AMBIENT_LIGHT = 5,          /**< Ambient light sensor */
1988        SENSOR_TYPE_ID_MAGNETIC_FIELD = 6,         /**< Magnetic field sensor */
1989        SENSOR_TYPE_ID_BAROMETER = 8,              /**< Barometric pressure sensor */
1990        SENSOR_TYPE_ID_HALL = 10,                  /**< Hall effect sensor */
1991        SENSOR_TYPE_ID_PROXIMITY = 12,             /**< Proximity sensor */
1992        SENSOR_TYPE_ID_HUMIDITY = 13,              /**< Humidity sensor */
1993        SENSOR_TYPE_ID_ORIENTATION = 256,          /**< Orientation sensor */
1994        SENSOR_TYPE_ID_GRAVITY = 257,              /**< Gravity sensor */
1995        SENSOR_TYPE_ID_LINEAR_ACCELERATION = 258,  /**< Linear acceleration sensor */
1996        SENSOR_TYPE_ID_ROTATION_VECTOR = 259,      /**< Rotation vector sensor */
1997        SENSOR_TYPE_ID_AMBIENT_TEMPERATURE = 260,  /**< Ambient temperature sensor */
1998        SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED = 261,  /**< Uncalibrated magnetic field sensor */
1999        SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED = 263,  /**< Uncalibrated gyroscope sensor */
2000        SENSOR_TYPE_ID_SIGNIFICANT_MOTION = 264,    /**< Significant motion sensor */
2001        SENSOR_TYPE_ID_PEDOMETER_DETECTION = 265,   /**< Pedometer detection sensor */
2002        SENSOR_TYPE_ID_PEDOMETER = 266,             /**< Pedometer sensor */
2003        SENSOR_TYPE_ID_HEART_RATE = 278,            /**< Heart rate sensor */
2004        SENSOR_TYPE_ID_WEAR_DETECTION = 280,        /**< Wear detection sensor */
2005        SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED = 281   /**< Uncalibrated acceleration sensor */
2006    }
2007
2008    /**
2009     * The basic data structure of the sensor event.
2010     * @syscap SystemCapability.Sensors.Sensor
2011     * @since 8
2012     */
2013    interface Response {
2014        timestamp: number; /**< The timestamp of the reported sensor data */
2015    }
2016
2017    /**
2018     * Acceleration sensor event data.
2019     * @syscap SystemCapability.Sensors.Sensor
2020     * @since 8
2021     */
2022    interface AccelerometerResponse extends Response {
2023        x: number; /**< Acceleration x-axis component */
2024        y: number; /**< Acceleration y-axis component */
2025        z: number; /**< Acceleration z-axis component */
2026    }
2027
2028    /**
2029     * Linear acceleration sensor event data.
2030     * @syscap SystemCapability.Sensors.Sensor
2031     * @since 8
2032     */
2033    interface LinearAccelerometerResponse extends Response{
2034        x: number; /**< Linear acceleration x-axis component */
2035        y: number; /**< Linear acceleration y-axis component */
2036        z: number; /**< Linear acceleration z-axis component */
2037    }
2038
2039    /**
2040     * Acceleration uncalibrated sensor event data.
2041     * @syscap SystemCapability.Sensors.Sensor
2042     * @since 8
2043     */
2044    interface AccelerometerUncalibratedResponse extends Response {
2045        x: number; /**< Acceleration uncalibrated x-axis component */
2046        y: number; /**< Acceleration uncalibrated y-axis component */
2047        z: number; /**< Acceleration uncalibrated z-axis component */
2048        biasX: number; /**< Acceleration uncalibrated x-axis offset */
2049        biasY: number; /**< Acceleration uncalibrated y-axis offset */
2050        biasZ: number; /**< Acceleration uncalibrated z-axis offset */
2051    }
2052
2053    /**
2054     * Gravity sensor event data.
2055     * @syscap SystemCapability.Sensors.Sensor
2056     * @since 8
2057     */
2058    interface GravityResponse extends Response {
2059        x: number; /**< Gravity x-axis component */
2060        y: number; /**< Gravity y-axis component */
2061        z: number; /**< Gravity z-axis component */
2062    }
2063
2064    /**
2065     * Orientation sensor event data.
2066     * @syscap SystemCapability.Sensors.Sensor
2067     * @since 8
2068     */
2069    interface OrientationResponse extends Response {
2070        alpha: number; /**< The device rotates at an angle around the Z axis */
2071        beta: number; /**< The device rotates at an angle around the X axis */
2072        gamma: number; /**< The device rotates at an angle around the Y axis */
2073    }
2074
2075    /**
2076     * Rotation vector sensor event data.
2077     * @syscap SystemCapability.Sensors.Sensor
2078     * @since 8
2079     */
2080    interface RotationVectorResponse extends Response {
2081        x: number; /**< Rotation vector x-axis component */
2082        y: number; /**< Rotation vector y-axis component */
2083        z: number; /**< Rotation vector z-axis component */
2084        w: number; /**< Scalar quantity */
2085    }
2086
2087    /**
2088     * Gyroscope sensor event data.
2089     * @syscap SystemCapability.Sensors.Sensor
2090     * @since 8
2091     */
2092    interface GyroscopeResponse extends Response {
2093        x: number; /**< Gyroscope x-axis component */
2094        y: number; /**< Gyroscope y-axis component */
2095        z: number; /**< Gyroscope z-axis component */
2096    }
2097
2098    /**
2099     * Gyroscope uncalibrated sensor event data.
2100     * @syscap SystemCapability.Sensors.Sensor
2101     * @since 8
2102     */
2103    interface GyroscopeUncalibratedResponse extends Response {
2104        x: number; /**< Gyroscope uncalibrated x-axis component */
2105        y: number; /**< Gyroscope uncalibrated y-axis component */
2106        z: number; /**< Gyroscope uncalibrated z-axis component */
2107        biasX: number; /**< Gyroscope uncalibrated x-axis offset */
2108        biasY: number; /**< Gyroscope uncalibrated y-axis offset */
2109        biasZ: number; /**< Gyroscope uncalibrated z-axis offset */
2110    }
2111
2112    /**
2113     * Significant motion sensor event data.
2114     * @syscap SystemCapability.Sensors.Sensor
2115     * @since 8
2116     */
2117    interface SignificantMotionResponse extends Response {
2118        scalar: number; /**< The degree of significant motion */
2119    }
2120
2121    /**
2122     * Proximity sensor event data.
2123     * @syscap SystemCapability.Sensors.Sensor
2124     * @since 8
2125     */
2126    interface ProximityResponse extends Response {
2127        distance: number; /**< Indicates the degree of proximity, event 0 indicates proximity, and greater than 0 indicates distance */
2128    }
2129
2130    /**
2131     * Light sensor event data.
2132     * @syscap SystemCapability.Sensors.Sensor
2133     * @since 8
2134     */
2135    interface LightResponse extends Response {
2136        intensity: number; /**< Indicates light intensity, in lux */
2137    }
2138
2139    /**
2140     * Hall sensor event data.
2141     * @syscap SystemCapability.Sensors.Sensor
2142     * @since 8
2143     */
2144    interface HallResponse extends Response {
2145        status: number; /**< Indicates hall status, 0 indicates open, and greater than 0 indicates suction */
2146    }
2147
2148    /**
2149     * Magnetic field sensor event data.
2150     * @syscap SystemCapability.Sensors.Sensor
2151     * @since 8
2152     */
2153    interface MagneticFieldResponse extends Response {
2154        x: number; /**< Magnetic field x-axis component */
2155        y: number; /**< Magnetic field y-axis component */
2156        z: number; /**< Magnetic field z-axis component */
2157    }
2158
2159    /**
2160     * Magnetic field uncalibrated sensor event data.
2161     * @syscap SystemCapability.Sensors.Sensor
2162     * @since 8
2163     */
2164    interface MagneticFieldUncalibratedResponse extends Response {
2165        x: number; /**< Magnetic field uncalibrated x-axis component */
2166        y: number; /**< Magnetic field uncalibrated y-axis component */
2167        z: number; /**< Magnetic field uncalibrated z-axis component */
2168        biasX: number; /**< Magnetic field uncalibrated x-axis offset */
2169        biasY: number; /**< Magnetic field uncalibrated y-axis offset */
2170        biasZ: number; /**< Magnetic field uncalibrated z-axis offset */
2171    }
2172
2173    /**
2174     * Pedometer sensor event data.
2175     * @syscap SystemCapability.Sensors.Sensor
2176     * @since 8
2177     */
2178    interface PedometerResponse extends Response {
2179        steps: number; /**< Indicates the number of steps */
2180    }
2181
2182    /**
2183     * Humidity sensor event data.
2184     * @syscap SystemCapability.Sensors.Sensor
2185     * @since 8
2186     */
2187    interface HumidityResponse extends Response {
2188        humidity: number; /**< Indicates the number of humidity */
2189    }
2190
2191    /**
2192     * Pedometer detection sensor event data.
2193     * @syscap SystemCapability.Sensors.Sensor
2194     * @since 8
2195     */
2196    interface PedometerDetectionResponse extends Response {
2197        scalar: number; /**< Indicates the pedometer detection status, 1 indicates that a walking action has occurred, and 0 indicates that no movement has occurred */
2198    }
2199
2200    /**
2201     * Ambient temperature sensor event data.
2202     * @syscap SystemCapability.Sensors.Sensor
2203     * @since 8
2204     */
2205    interface AmbientTemperatureResponse extends Response {
2206        temperature: number; /**< Indicates ambient temperature, in celsius */
2207    }
2208
2209    /**
2210     * Barometer sensor event data.
2211     * @syscap SystemCapability.Sensors.Sensor
2212     * @since 8
2213     */
2214    interface BarometerResponse extends Response {
2215        pressure: number; /**< Indicates the number of barometer, in pascal */
2216    }
2217
2218    /**
2219     * Heart rate sensor event data.
2220     * @syscap SystemCapability.Sensors.Sensor
2221     * @since 8
2222     */
2223    interface HeartRateResponse extends Response {
2224        heartRate: number; /**< Indicates the number of heart rate */
2225    }
2226
2227    /**
2228     * Wear detection sensor event data.
2229     * @syscap SystemCapability.Sensors.Sensor
2230     * @since 8
2231     */
2232    interface WearDetectionResponse extends Response {
2233        value: number; /**< Indicates the status of wear detection, 1 for wearing, 0 for wearing not */
2234    }
2235 }
2236
2237 export default sensor;