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 './@ohos.base'; 17 18/** 19 * This module provides the capability to subscribe to sensor data. 20 * @namespace sensor 21 * @syscap SystemCapability.Sensors.Sensor 22 * @since 8 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 /** 33 * Acceleration sensor. 34 * @syscap SystemCapability.Sensors.Sensor 35 * @since 9 36 */ 37 ACCELEROMETER = 1, 38 39 /** 40 * Gyroscope sensor. 41 * @syscap SystemCapability.Sensors.Sensor 42 * @since 9 43 */ 44 GYROSCOPE = 2, 45 46 /** 47 * Ambient light sensor. 48 * @syscap SystemCapability.Sensors.Sensor 49 * @since 9 50 */ 51 AMBIENT_LIGHT = 5, 52 53 /** 54 * Magnetic field sensor. 55 * @syscap SystemCapability.Sensors.Sensor 56 * @since 9 57 */ 58 MAGNETIC_FIELD = 6, 59 60 /** 61 * Barometric pressure sensor. 62 * @syscap SystemCapability.Sensors.Sensor 63 * @since 9 64 */ 65 BAROMETER = 8, 66 67 /** 68 * Hall effect sensor. 69 * @syscap SystemCapability.Sensors.Sensor 70 * @since 9 71 */ 72 HALL = 10, 73 74 /** 75 * Proximity sensor. 76 * @syscap SystemCapability.Sensors.Sensor 77 * @since 9 78 */ 79 PROXIMITY = 12, 80 81 /** 82 * Humidity sensor. 83 * @syscap SystemCapability.Sensors.Sensor 84 * @since 9 85 */ 86 HUMIDITY = 13, 87 88 /** 89 * Color sensor. 90 * @syscap SystemCapability.Sensors.Sensor 91 * @systemapi 92 * @since 10 93 */ 94 COLOR = 14, 95 96 /** 97 * Sar sensor. 98 * @syscap SystemCapability.Sensors.Sensor 99 * @systemapi 100 * @since 10 101 */ 102 SAR = 15, 103 104 /** 105 * Orientation sensor. 106 * @syscap SystemCapability.Sensors.Sensor 107 * @since 9 108 */ 109 ORIENTATION = 256, 110 111 /** 112 * Gravity sensor. 113 * @syscap SystemCapability.Sensors.Sensor 114 * @since 9 115 */ 116 GRAVITY = 257, 117 118 /** 119 * Linear acceleration sensor. 120 * @syscap SystemCapability.Sensors.Sensor 121 * @since 9 122 */ 123 LINEAR_ACCELEROMETER = 258, 124 125 /** 126 * Rotation vector sensor. 127 * @syscap SystemCapability.Sensors.Sensor 128 * @since 9 129 */ 130 ROTATION_VECTOR = 259, 131 132 /** 133 * Ambient temperature sensor. 134 * @syscap SystemCapability.Sensors.Sensor 135 * @since 9 136 */ 137 AMBIENT_TEMPERATURE = 260, 138 139 /** 140 * Uncalibrated magnetic field sensor. 141 * @syscap SystemCapability.Sensors.Sensor 142 * @since 9 143 */ 144 MAGNETIC_FIELD_UNCALIBRATED = 261, 145 146 /** 147 * Uncalibrated gyroscope sensor. 148 * @syscap SystemCapability.Sensors.Sensor 149 * @since 9 150 */ 151 GYROSCOPE_UNCALIBRATED = 263, 152 153 /** 154 * Significant motion sensor. 155 * @syscap SystemCapability.Sensors.Sensor 156 * @since 9 157 */ 158 SIGNIFICANT_MOTION = 264, 159 160 /** 161 * Pedometer detection sensor. 162 * @syscap SystemCapability.Sensors.Sensor 163 * @since 9 164 */ 165 PEDOMETER_DETECTION = 265, 166 167 /** 168 * Pedometer sensor. 169 * @syscap SystemCapability.Sensors.Sensor 170 * @since 9 171 */ 172 PEDOMETER = 266, 173 174 /** 175 * Heart rate sensor. 176 * @syscap SystemCapability.Sensors.Sensor 177 * @since 9 178 */ 179 HEART_RATE = 278, 180 181 /** 182 * Wear detection sensor. 183 * @syscap SystemCapability.Sensors.Sensor 184 * @since 9 185 */ 186 WEAR_DETECTION = 280, 187 188 /** 189 * Uncalibrated acceleration sensor. 190 * @syscap SystemCapability.Sensors.Sensor 191 * @since 9 192 */ 193 ACCELEROMETER_UNCALIBRATED = 281 194 } 195 196 /** 197 * Subscribe to color sensor data. 198 * @param { SensorId.COLOR } type - Indicate the sensor type to listen for, {@code SensorId.COLOR}. 199 * @param { Callback<ColorResponse> } callback - callback color data. 200 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 201 * @throws { BusinessError } 401 - Parameter error. 202 * @throws { BusinessError } 14500101 - Service exception. 203 * @syscap SystemCapability.Sensors.Sensor 204 * @systemapi 205 * @since 10 206 */ 207 function on(type: SensorId.COLOR, callback: Callback<ColorResponse>, options?: Options): void; 208 209 /** 210 * Subscribe to SAR sensor data. 211 * @param { SensorId.SAR } type - Indicate the sensor type to listen for, {@code SensorId.SAR}. 212 * @param { Callback<SarResponse> } callback - callback sar data. 213 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 214 * @throws { BusinessError } 401 - Parameter error. 215 * @throws { BusinessError } 14500101 - Service exception. 216 * @syscap SystemCapability.Sensors.Sensor 217 * @systemapi 218 * @since 10 219 */ 220 function on(type: SensorId.SAR, callback: Callback<SarResponse>, options?: Options): void; 221 222 /** 223 * Subscribe to accelerometer sensor data. 224 * @permission ohos.permission.ACCELEROMETER 225 * @param { SensorId.ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}. 226 * @param { Callback<AccelerometerResponse> } callback - callback accelerometer data. 227 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 228 * @throws { BusinessError } 201 - Permission denied. 229 * @throws { BusinessError } 401 - Parameter error. 230 * @throws { BusinessError } 14500101 - Service exception. 231 * @syscap SystemCapability.Sensors.Sensor 232 * @since 9 233 */ 234 function on(type: SensorId.ACCELEROMETER, callback: Callback<AccelerometerResponse>, 235 options?: Options): void; 236 237 /** 238 * Subscribe to uncalibrated accelerometer sensor data. 239 * @permission ohos.permission.ACCELEROMETER 240 * @param { SensorId.ACCELEROMETER_UNCALIBRATED } type - Indicate the sensor type to listen for,{@code SensorId.ACCELEROMETER_UNCALIBRATED}. 241 * @param { Callback<AccelerometerUncalibratedResponse> } callback - callback uncalibrated accelerometer data. 242 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 243 * @throws { BusinessError } 201 - Permission denied. 244 * @throws { BusinessError } 401 - Parameter error. 245 * @throws { BusinessError } 14500101 - Service exception. 246 * @syscap SystemCapability.Sensors.Sensor 247 * @since 9 248 */ 249 function on(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>, 250 options?: Options): void; 251 252 /** 253 * Subscribe to ambient light sensor data. 254 * @param { SensorId.AMBIENT_LIGHT } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_LIGHT}. 255 * @param { Callback<LightResponse> } callback - callback ambient data. 256 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 257 * @throws { BusinessError } 401 - Parameter error. 258 * @throws { BusinessError } 14500101 - Service exception. 259 * @syscap SystemCapability.Sensors.Sensor 260 * @since 9 261 */ 262 function on(type: SensorId.AMBIENT_LIGHT, callback: Callback<LightResponse>, options?: Options): void; 263 264 /** 265 * Subscribe to ambient temperature sensor data. 266 * @param { SensorId.AMBIENT_TEMPERATURE } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_TEMPERATURE}. 267 * @param { Callback<AmbientTemperatureResponse> } callback - callback temperature data. 268 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 269 * @throws { BusinessError } 401 - Parameter error. 270 * @throws { BusinessError } 14500101 - Service exception. 271 * @syscap SystemCapability.Sensors.Sensor 272 * @since 9 273 */ 274 function on(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>, 275 options?: Options): void; 276 277 /** 278 * Subscribe to barometer sensor data. 279 * @param { SensorId.BAROMETER } type - Indicate the sensor type to listen for, {@code SensorId.BAROMETER}. 280 * @param { Callback<BarometerResponse> } callback - callback barometer data. 281 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 282 * @throws { BusinessError } 401 - Parameter error. 283 * @throws { BusinessError } 14500101 - Service exception. 284 * @syscap SystemCapability.Sensors.Sensor 285 * @since 9 286 */ 287 function on(type: SensorId.BAROMETER, callback: Callback<BarometerResponse>, options?: Options): void; 288 289 /** 290 * Subscribe to gravity sensor data. 291 * @param { SensorId.GRAVITY } type - Indicate the sensor type to listen for, {@code SensorId.GRAVITY}. 292 * @param { Callback<GravityResponse> } callback - callback gravity data. 293 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 294 * @throws { BusinessError } 401 - Parameter error. 295 * @throws { BusinessError } 14500101 - Service exception. 296 * @syscap SystemCapability.Sensors.Sensor 297 * @since 9 298 */ 299 function on(type: SensorId.GRAVITY, callback: Callback<GravityResponse>, 300 options?: Options): void; 301 302 /** 303 * Subscribe to gyroscope sensor data. 304 * @permission ohos.permission.GYROSCOPE 305 * @param { SensorId.GYROSCOPE } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}. 306 * @param { Callback<GyroscopeResponse> } callback - callback gyroscope data. 307 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 308 * @throws { BusinessError } 201 - Permission denied. 309 * @throws { BusinessError } 401 - Parameter error. 310 * @throws { BusinessError } 14500101 - Service exception. 311 * @syscap SystemCapability.Sensors.Sensor 312 * @since 9 313 */ 314 function on(type: SensorId.GYROSCOPE, callback: Callback<GyroscopeResponse>, 315 options?: Options): void; 316 317 /** 318 * Subscribe to uncalibrated gyroscope sensor data. 319 * @permission ohos.permission.GYROSCOPE 320 * @param { SensorId.GYROSCOPE_UNCALIBRATED } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE_UNCALIBRATED}. 321 * @param { Callback<GyroscopeUncalibratedResponse> } callback - callback uncalibrated gyroscope data. 322 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 323 * @throws { BusinessError } 201 - Permission denied. 324 * @throws { BusinessError } 401 - Parameter error. 325 * @throws { BusinessError } 14500101 - Service exception. 326 * @syscap SystemCapability.Sensors.Sensor 327 * @since 9 328 */ 329 function on(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>, 330 options?: Options): void; 331 332 /** 333 * Subscribe to hall sensor data. 334 * @param { SensorId.HALL } type - Indicate the sensor type to listen for, {@code SensorId.HALL}. 335 * @param { Callback<HallResponse> } callback - callback uncalibrated gyroscope data. 336 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 337 * @throws { BusinessError } 401 - Parameter error. 338 * @throws { BusinessError } 14500101 - Service exception. 339 * @syscap SystemCapability.Sensors.Sensor 340 * @since 9 341 */ 342 function on(type: SensorId.HALL, callback: Callback<HallResponse>, options?: Options): void; 343 344 /** 345 * Subscribe to heart rate sensor data. 346 * @permission ohos.permission.READ_HEALTH_DATA 347 * @param { SensorId.HEART_RATE } type - Indicate the sensor type to listen for, {@code SensorId.HEART_RATE}. 348 * @param { Callback<HeartRateResponse> } callback - callback heart rate data. 349 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 350 * @throws { BusinessError } 201 - Permission denied. 351 * @throws { BusinessError } 401 - Parameter error. 352 * @throws { BusinessError } 14500101 - Service exception. 353 * @syscap SystemCapability.Sensors.Sensor 354 * @since 9 355 */ 356 function on(type: SensorId.HEART_RATE, callback: Callback<HeartRateResponse>, 357 options?: Options): void; 358 359 /** 360 * Subscribe to humidity sensor data. 361 * @param { SensorId.HUMIDITY } type - Indicate the sensor type to listen for, {@code SensorId.HUMIDITY}. 362 * @param { Callback<HumidityResponse> } callback - callback humidity data. 363 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 364 * @throws { BusinessError } 401 - Parameter error. 365 * @throws { BusinessError } 14500101 - Service exception. 366 * @syscap SystemCapability.Sensors.Sensor 367 * @since 9 368 */ 369 function on(type: SensorId.HUMIDITY, callback: Callback<HumidityResponse>, 370 options?: Options): void; 371 372 /** 373 * Subscribe to linear acceleration sensor data. 374 * @permission ohos.permission.ACCELEROMETER 375 * @param { SensorId.LINEAR_ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.LINEAR_ACCELEROMETER}. 376 * @param { Callback<LinearAccelerometerResponse> } callback - callback linear acceleration data. 377 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 378 * @throws { BusinessError } 201 - Permission denied. 379 * @throws { BusinessError } 401 - Parameter error. 380 * @throws { BusinessError } 14500101 - Service exception. 381 * @syscap SystemCapability.Sensors.Sensor 382 * @since 9 383 */ 384 function on(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback<LinearAccelerometerResponse>, 385 options?: Options): void; 386 387 /** 388 * Subscribe to magnetic field sensor data. 389 * @param { SensorId.MAGNETIC_FIELD } type - Indicate the sensor type to listen for, {@code SensorId.MAGNETIC_FIELD}. 390 * @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data. 391 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 392 * @throws { BusinessError } 401 - Parameter error. 393 * @throws { BusinessError } 14500101 - Service exception. 394 * @syscap SystemCapability.Sensors.Sensor 395 * @since 9 396 */ 397 function on(type: SensorId.MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>, 398 options?: Options): void; 399 400 /** 401 * Subscribe to uncalibrated magnetic field sensor data. 402 * @param { SensorId.MAGNETIC_FIELD_UNCALIBRATED } type - Indicate the sensor type to listen for, 403 * {@code SensorId.MAGNETIC_FIELD_UNCALIBRATED}. 404 * @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback uncalibrated magnetic field data. 405 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 406 * @throws { BusinessError } 401 - Parameter error. 407 * @throws { BusinessError } 14500101 - Service exception. 408 * @syscap SystemCapability.Sensors.Sensor 409 * @since 9 410 */ 411 function on(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>, 412 options?: Options): void; 413 414 /** 415 * Subscribe to orientation sensor data. 416 * @param { SensorId.ORIENTATION } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}. 417 * @param { Callback<OrientationResponse> } callback - callback orientation data. 418 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 419 * @throws { BusinessError } 401 - Parameter error. 420 * @throws { BusinessError } 14500101 - Service exception. 421 * @syscap SystemCapability.Sensors.Sensor 422 * @since 9 423 */ 424 function on(type: SensorId.ORIENTATION, callback: Callback<OrientationResponse>, 425 options?: Options): void; 426 427 /** 428 * Subscribe to pedometer sensor data. 429 * @permission ohos.permission.ACTIVITY_MOTION 430 * @param { SensorId.PEDOMETER } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER}. 431 * @param { Callback<PedometerResponse> } callback - callback pedometer data. 432 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 433 * @throws { BusinessError } 201 - Permission denied. 434 * @throws { BusinessError } 401 - Parameter error. 435 * @throws { BusinessError } 14500101 - Service exception. 436 * @syscap SystemCapability.Sensors.Sensor 437 * @since 9 438 */ 439 function on(type: SensorId.PEDOMETER, callback: Callback<PedometerResponse>, options?: Options): void; 440 441 /** 442 * Subscribe to pedometer detection sensor data. 443 * @permission ohos.permission.ACTIVITY_MOTION 444 * @param { SensorId.PEDOMETER_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER_DETECTION}. 445 * @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data. 446 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 447 * @throws { BusinessError } 201 - Permission denied. 448 * @throws { BusinessError } 401 - Parameter error. 449 * @throws { BusinessError } 14500101 - Service exception. 450 * @syscap SystemCapability.Sensors.Sensor 451 * @since 9 452 */ 453 function on(type: SensorId.PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>, 454 options?: Options): void; 455 456 /** 457 * Subscribe to proximity sensor data. 458 * @param { SensorId.PROXIMITY } type - Indicate the sensor type to listen for, {@code SensorId.PROXIMITY}. 459 * @param { Callback<ProximityResponse> } callback - callback proximity data. 460 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 461 * @throws { BusinessError } 401 - Parameter error. 462 * @throws { BusinessError } 14500101 - Service exception. 463 * @syscap SystemCapability.Sensors.Sensor 464 * @since 9 465 */ 466 function on(type: SensorId.PROXIMITY, callback: Callback<ProximityResponse>, options?: Options): void; 467 468 /** 469 * Subscribe to rotation vector sensor data. 470 * @param { SensorId.ROTATION_VECTOR } type - Indicate the sensor type to listen for, {@code SensorId.ROTATION_VECTOR}. 471 * @param { Callback<RotationVectorResponse> } callback - callback rotation vector data. 472 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 473 * @throws { BusinessError } 401 - Parameter error. 474 * @throws { BusinessError } 14500101 - Service exception. 475 * @syscap SystemCapability.Sensors.Sensor 476 * @since 9 477 */ 478 function on(type: SensorId.ROTATION_VECTOR, callback: Callback<RotationVectorResponse>, 479 options?: Options): void; 480 481 /** 482 * Subscribe to significant motion sensor data. 483 * @param { SensorId.SIGNIFICANT_MOTION } type - Indicate the sensor type to listen for, {@code SensorId.SIGNIFICANT_MOTION}. 484 * @param { Callback<SignificantMotionResponse> } callback - callback significant motion data. 485 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 486 * @throws { BusinessError } 401 - Parameter error. 487 * @throws { BusinessError } 14500101 - Service exception. 488 * @syscap SystemCapability.Sensors.Sensor 489 * @since 9 490 */ 491 function on(type: SensorId.SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>, 492 options?: Options): void; 493 494 /** 495 * Subscribe to wear detection sensor data. 496 * @param { SensorId.WEAR_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.WEAR_DETECTION}. 497 * @param { Callback<WearDetectionResponse> } callback - callback wear detection data. 498 * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 499 * @throws { BusinessError } 401 - Parameter error. 500 * @throws { BusinessError } 14500101 - Service exception. 501 * @syscap SystemCapability.Sensors.Sensor 502 * @since 9 503 */ 504 function on(type: SensorId.WEAR_DETECTION, callback: Callback<WearDetectionResponse>, 505 options?: Options): void; 506 507 /** 508 * Subscribe to accelerometer sensor data once. 509 * @permission ohos.permission.ACCELEROMETER 510 * @param { SensorId.ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}. 511 * @param { Callback<AccelerometerResponse> } callback - callback accelerometer data. 512 * @throws { BusinessError } 201 - Permission denied. 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.ACCELEROMETER, callback: Callback<AccelerometerResponse>): void; 519 520 /** 521 * Subscribe to uncalibrated accelerometer sensor data once. 522 * @permission ohos.permission.ACCELEROMETER 523 * @param { SensorId.ACCELEROMETER_UNCALIBRATED } type - Indicate the sensor type to listen for,{@code SensorId.ACCELEROMETER_UNCALIBRATED}. 524 * @param { Callback<AccelerometerUncalibratedResponse> } callback - callback uncalibrated accelerometer data. 525 * @throws { BusinessError } 201 - Permission denied. 526 * @throws { BusinessError } 401 - Parameter error. 527 * @throws { BusinessError } 14500101 - Service exception. 528 * @syscap SystemCapability.Sensors.Sensor 529 * @since 9 530 */ 531 function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>): void; 532 533 /** 534 * Subscribe to ambient light sensor data once. 535 * @param { SensorId.AMBIENT_LIGHT } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_LIGHT}. 536 * @param { Callback<LightResponse> } callback - callback ambient data. 537 * @throws { BusinessError } 401 - Parameter error. 538 * @throws { BusinessError } 14500101 - Service exception. 539 * @syscap SystemCapability.Sensors.Sensor 540 * @since 9 541 */ 542 function once(type: SensorId.AMBIENT_LIGHT, callback: Callback<LightResponse>): void; 543 544 /** 545 * Subscribe to ambient temperature sensor data once. 546 * @param { SensorId.AMBIENT_TEMPERATURE } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_TEMPERATURE}. 547 * @param { Callback<AmbientTemperatureResponse> } callback - callback temperature data. 548 * @throws { BusinessError } 401 - Parameter error. 549 * @throws { BusinessError } 14500101 - Service exception. 550 * @syscap SystemCapability.Sensors.Sensor 551 * @since 9 552 */ 553 function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>): void; 554 555 /** 556 * Subscribe to barometer sensor data once. 557 * @param { SensorId.BAROMETER } type - Indicate the sensor type to listen for, {@code SensorId.BAROMETER}. 558 * @param { Callback<BarometerResponse> } callback - callback barometer data. 559 * @throws { BusinessError } 401 - Parameter error. 560 * @throws { BusinessError } 14500101 - Service exception. 561 * @syscap SystemCapability.Sensors.Sensor 562 * @since 9 563 */ 564 function once(type: SensorId.BAROMETER, callback: Callback<BarometerResponse>): void; 565 566 /** 567 * Subscribe to gravity sensor data once. 568 * @param { SensorId.GRAVITY } type - Indicate the sensor type to listen for, {@code SensorId.GRAVITY}. 569 * @param { Callback<GravityResponse> } callback - callback gravity data. 570 * @throws { BusinessError } 401 - Parameter error. 571 * @throws { BusinessError } 14500101 - Service exception. 572 * @syscap SystemCapability.Sensors.Sensor 573 * @since 9 574 */ 575 function once(type: SensorId.GRAVITY, callback: Callback<GravityResponse>): void; 576 577 /** 578 * Subscribe to gyroscope sensor data once. 579 * @permission ohos.permission.GYROSCOPE 580 * @param { SensorId.GYROSCOPE } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}. 581 * @param { Callback<GyroscopeResponse> } callback - callback gyroscope data. 582 * @throws { BusinessError } 201 - Permission denied. 583 * @throws { BusinessError } 401 - Parameter error. 584 * @throws { BusinessError } 14500101 - Service exception. 585 * @syscap SystemCapability.Sensors.Sensor 586 * @since 9 587 */ 588 function once(type: SensorId.GYROSCOPE, callback: Callback<GyroscopeResponse>): void; 589 590 /** 591 * Subscribe to uncalibrated gyroscope sensor data once. 592 * @permission ohos.permission.GYROSCOPE 593 * @param { SensorId.GYROSCOPE_UNCALIBRATED } type - Indicate the sensor type to listen for,{@code SensorId.GYROSCOPE_UNCALIBRATED}. 594 * @param { Callback<GyroscopeUncalibratedResponse> } callback - callback uncalibrated gyroscope data. 595 * @throws { BusinessError } 201 - Permission denied. 596 * @throws { BusinessError } 401 - Parameter error. 597 * @throws { BusinessError } 14500101 - Service exception. 598 * @syscap SystemCapability.Sensors.Sensor 599 * @since 9 600 */ 601 function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>): void; 602 603 /** 604 * Subscribe to hall sensor data once. 605 * @param { SensorId.HALL } type - Indicate the sensor type to listen for, {@code SensorId.HALL}. 606 * @param { Callback<HallResponse> } callback - callback uncalibrated gyroscope data. 607 * @throws { BusinessError } 401 - Parameter error. 608 * @throws { BusinessError } 14500101 - Service exception. 609 * @syscap SystemCapability.Sensors.Sensor 610 * @since 9 611 */ 612 function once(type: SensorId.HALL, callback: Callback<HallResponse>): void; 613 614 /** 615 * Subscribe to heart rate sensor data once. 616 * @permission ohos.permission.READ_HEALTH_DATA 617 * @param { SensorId.HEART_RATE } type - Indicate the sensor type to listen for, {@code SensorId.HEART_RATE}. 618 * @param { Callback<HeartRateResponse> } callback - callback heart rate data. 619 * @throws { BusinessError } 201 - Permission denied. 620 * @throws { BusinessError } 401 - Parameter error. 621 * @throws { BusinessError } 14500101 - Service exception. 622 * @syscap SystemCapability.Sensors.Sensor 623 * @since 9 624 */ 625 function once(type: SensorId.HEART_RATE, callback: Callback<HeartRateResponse>): void; 626 627 /** 628 * Subscribe to humidity sensor data once. 629 * @param { SensorId.HUMIDITY } type - Indicate the sensor type to listen for, {@code SensorId.HUMIDITY}. 630 * @param { Callback<HumidityResponse> } callback - callback humidity data. 631 * @throws { BusinessError } 401 - Parameter error. 632 * @throws { BusinessError } 14500101 - Service exception. 633 * @syscap SystemCapability.Sensors.Sensor 634 * @since 9 635 */ 636 function once(type: SensorId.HUMIDITY, callback: Callback<HumidityResponse>): void; 637 638 /** 639 * Subscribe to linear acceleration sensor data once. 640 * @permission ohos.permission.ACCELEROMETER 641 * @param { SensorId.LINEAR_ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.LINEAR_ACCELEROMETER}. 642 * @param { Callback<LinearAccelerometerResponse> } callback - callback linear acceleration data. 643 * @throws { BusinessError } 201 - Permission denied. 644 * @throws { BusinessError } 401 - Parameter error. 645 * @throws { BusinessError } 14500101 - Service exception. 646 * @syscap SystemCapability.Sensors.Sensor 647 * @since 9 648 */ 649 function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback<LinearAccelerometerResponse>): void; 650 651 /** 652 * Subscribe to magnetic field sensor data once. 653 * @param { SensorId.MAGNETIC_FIELD } type - Indicate the sensor type to listen for, {@code SensorId.MAGNETIC_FIELD}. 654 * @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data. 655 * @throws { BusinessError } 401 - Parameter error. 656 * @throws { BusinessError } 14500101 - Service exception. 657 * @syscap SystemCapability.Sensors.Sensor 658 * @since 9 659 */ 660 function once(type: SensorId.MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>): void; 661 662 /** 663 * Subscribe to uncalibrated magnetic field sensor data once. 664 * @param { SensorId.MAGNETIC_FIELD_UNCALIBRATED } type - Indicate the sensor type to listen for, 665 * {@code SensorId.MAGNETIC_FIELD_UNCALIBRATED}. 666 * @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback uncalibrated magnetic field data. 667 * @throws { BusinessError } 401 - Parameter error. 668 * @throws { BusinessError } 14500101 - Service exception. 669 * @syscap SystemCapability.Sensors.Sensor 670 * @since 9 671 */ 672 function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>): void; 673 674 /** 675 * Subscribe to orientation sensor data once. 676 * @param { SensorId.ORIENTATION } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}. 677 * @param { Callback<OrientationResponse> } callback - callback orientation data. 678 * @throws { BusinessError } 401 - Parameter error. 679 * @throws { BusinessError } 14500101 - Service exception. 680 * @syscap SystemCapability.Sensors.Sensor 681 * @since 9 682 */ 683 function once(type: SensorId.ORIENTATION, callback: Callback<OrientationResponse>): void; 684 685 /** 686 * Subscribe to pedometer sensor data once. 687 * @permission ohos.permission.ACTIVITY_MOTION 688 * @param { SensorId.PEDOMETER } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER}. 689 * @param { Callback<PedometerResponse> } callback - callback pedometer data. 690 * @throws { BusinessError } 201 - Permission denied. 691 * @throws { BusinessError } 401 - Parameter error. 692 * @throws { BusinessError } 14500101 - Service exception. 693 * @syscap SystemCapability.Sensors.Sensor 694 * @since 9 695 */ 696 function once(type: SensorId.PEDOMETER, callback: Callback<PedometerResponse>): void; 697 698 /** 699 * Subscribe to pedometer detection sensor data once. 700 * @permission ohos.permission.ACTIVITY_MOTION 701 * @param { SensorId.PEDOMETER_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER_DETECTION}. 702 * @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data. 703 * @throws { BusinessError } 201 - Permission denied. 704 * @throws { BusinessError } 401 - Parameter error. 705 * @throws { BusinessError } 14500101 - Service exception. 706 * @syscap SystemCapability.Sensors.Sensor 707 * @since 9 708 */ 709 function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>): void; 710 711 /** 712 * Subscribe to proximity sensor data once. 713 * @param { SensorId.PROXIMITY } type - Indicate the sensor type to listen for, {@code SensorId.PROXIMITY}. 714 * @param { Callback<ProximityResponse> } callback - callback proximity data. 715 * @throws { BusinessError } 401 - Parameter error. 716 * @throws { BusinessError } 14500101 - Service exception. 717 * @syscap SystemCapability.Sensors.Sensor 718 * @since 9 719 */ 720 function once(type: SensorId.PROXIMITY, callback: Callback<ProximityResponse>): void; 721 722 /** 723 * Subscribe to rotation vector sensor data once. 724 * @param { SensorId.ROTATION_VECTOR } type - Indicate the sensor type to listen for, {@code SensorId.ROTATION_VECTOR}. 725 * @param { Callback<RotationVectorResponse> } callback - callback rotation vector data. 726 * @throws { BusinessError } 401 - Parameter error. 727 * @throws { BusinessError } 14500101 - Service exception. 728 * @syscap SystemCapability.Sensors.Sensor 729 * @since 9 730 */ 731 function once(type: SensorId.ROTATION_VECTOR, callback: Callback<RotationVectorResponse>): void; 732 733 /** 734 * Subscribe to significant motion sensor data once. 735 * @param { SensorId.SIGNIFICANT_MOTION } type - Indicate the sensor type to listen for, {@code SensorId.SIGNIFICANT_MOTION}. 736 * @param { Callback<SignificantMotionResponse> } callback - callback significant motion data. 737 * @throws { BusinessError } 401 - Parameter error. 738 * @throws { BusinessError } 14500101 - Service exception. 739 * @syscap SystemCapability.Sensors.Sensor 740 * @since 9 741 */ 742 function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>): void; 743 744 /** 745 * Subscribe to wear detection sensor data once. 746 * @param { SensorId.WEAR_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.WEAR_DETECTION}. 747 * @param { Callback<WearDetectionResponse> } callback - callback wear detection data. 748 * @throws { BusinessError } 401 - Parameter error. 749 * @throws { BusinessError } 14500101 - Service exception. 750 * 751 * @syscap SystemCapability.Sensors.Sensor 752 * @since 9 753 */ 754 function once(type: SensorId.WEAR_DETECTION, callback: Callback<WearDetectionResponse>): void; 755 756 /** 757 * Unsubscribe to color sensor data. 758 * @param { SensorId.COLOR } type - Indicate the sensor type to listen for, {@code SensorId.COLOR}. 759 * @param { Callback<ColorResponse> } callback - callback color data. 760 * @throws { BusinessError } 401 - Parameter error. 761 * @syscap SystemCapability.Sensors.Sensor 762 * @systemapi 763 * @since 10 764 */ 765 function off(type: SensorId.COLOR, callback?: Callback<ColorResponse>): void; 766 767 /** 768 * Unsubscribe to sar sensor data. 769 * @param { SensorId.SAR } type - Indicate the sensor type to listen for, {@code SensorId.SAR}. 770 * @param { Callback<SarResponse> } callback - callback sar data. 771 * @throws { BusinessError } 401 - Parameter error. 772 * @syscap SystemCapability.Sensors.Sensor 773 * @systemapi 774 * @since 10 775 */ 776 function off(type: SensorId.SAR, callback?: Callback<SarResponse>): void; 777 778 /** 779 * Unsubscribe to accelerometer sensor data. 780 * @permission ohos.permission.ACCELEROMETER 781 * @param { SensorId.ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}. 782 * @param { Callback<AccelerometerResponse> } callback - callback accelerometer data. 783 * @throws { BusinessError } 201 - Permission denied. 784 * @throws { BusinessError } 401 - Parameter error. 785 * @syscap SystemCapability.Sensors.Sensor 786 * @since 9 787 */ 788 function off(type: SensorId.ACCELEROMETER, callback?: Callback<AccelerometerResponse>): void; 789 790 /** 791 * Unsubscribe to uncalibrated accelerometer sensor data. 792 * @permission ohos.permission.ACCELEROMETER 793 * @param { SensorId.ACCELEROMETER_UNCALIBRATED } type - Indicate the sensor type to listen for, 794 * {@code SensorId.ACCELEROMETER_UNCALIBRATED}. 795 * @param { Callback<AccelerometerUncalibratedResponse> } callback - callback uncalibrated accelerometer data. 796 * @throws { BusinessError } 201 - Permission denied. 797 * @throws { BusinessError } 401 - Parameter error. 798 * @syscap SystemCapability.Sensors.Sensor 799 * @since 9 800 */ 801 function off(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback?: Callback<AccelerometerUncalibratedResponse>): void; 802 803 /** 804 * Unsubscribe to ambient light sensor data. 805 * @param { SensorId.AMBIENT_LIGHT } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_LIGHT}. 806 * @param { Callback<LightResponse> } callback - callback ambient data. 807 * @throws { BusinessError } 401 - Parameter error. 808 * @syscap SystemCapability.Sensors.Sensor 809 * @since 9 810 */ 811 function off(type: SensorId.AMBIENT_LIGHT, callback?: Callback<LightResponse>): void; 812 813 /** 814 * Unsubscribe to ambient temperature sensor data. 815 * @param { SensorId.AMBIENT_TEMPERATURE } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_TEMPERATURE}. 816 * @param { Callback<AmbientTemperatureResponse> } callback - callback temperature data. 817 * @throws { BusinessError } 401 - Parameter error. 818 * @syscap SystemCapability.Sensors.Sensor 819 * @since 9 820 */ 821 function off(type: SensorId.AMBIENT_TEMPERATURE, callback?: Callback<AmbientTemperatureResponse>): void; 822 823 /** 824 * Unsubscribe to barometer sensor data. 825 * @param { SensorId.BAROMETER } type - Indicate the sensor type to listen for, {@code SensorId.BAROMETER}. 826 * @param { Callback<BarometerResponse> } callback - callback barometer data. 827 * @throws { BusinessError } 401 - Parameter error. 828 * @syscap SystemCapability.Sensors.Sensor 829 * @since 9 830 */ 831 function off(type: SensorId.BAROMETER, callback?: Callback<BarometerResponse>): void; 832 833 /** 834 * Unsubscribe to gravity sensor data. 835 * @param { SensorId.GRAVITY } type - Indicate the sensor type to listen for, {@code SensorId.GRAVITY}. 836 * @param { Callback<GravityResponse> } callback - callback gravity data. 837 * @throws { BusinessError } 401 - Parameter error. 838 * @syscap SystemCapability.Sensors.Sensor 839 * @since 9 840 */ 841 function off(type: SensorId.GRAVITY, callback?: Callback<GravityResponse>): void; 842 843 /** 844 * Unsubscribe to gyroscope sensor data. 845 * @permission ohos.permission.GYROSCOPE 846 * @param { SensorId.GYROSCOPE } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}. 847 * @param { Callback<GyroscopeResponse> } callback - callback gyroscope data. 848 * @throws { BusinessError } 201 - Permission denied. 849 * @throws { BusinessError } 401 - Parameter error. 850 * @syscap SystemCapability.Sensors.Sensor 851 * @since 9 852 */ 853 function off(type: SensorId.GYROSCOPE, callback?: Callback<GyroscopeResponse>): void; 854 855 /** 856 * Unsubscribe to uncalibrated gyroscope sensor data. 857 * @permission ohos.permission.GYROSCOPE 858 * @param { SensorId.GYROSCOPE_UNCALIBRATED } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE_UNCALIBRATED}. 859 * @param { Callback<GyroscopeUncalibratedResponse> } callback - callback uncalibrated gyroscope data. 860 * @throws { BusinessError } 201 - Permission denied. 861 * @throws { BusinessError } 401 - Parameter error. 862 * @syscap SystemCapability.Sensors.Sensor 863 * @since 9 864 */ 865 function off(type: SensorId.GYROSCOPE_UNCALIBRATED, callback?: Callback<GyroscopeUncalibratedResponse>): void; 866 867 /** 868 * Unsubscribe to hall sensor data. 869 * @param { SensorId.HALL } type - Indicate the sensor type to listen for, {@code SensorId.HALL}. 870 * @param { Callback<HallResponse> } callback - callback uncalibrated gyroscope data. 871 * @throws { BusinessError } 401 - Parameter error. 872 * @syscap SystemCapability.Sensors.Sensor 873 * @since 9 874 */ 875 function off(type: SensorId.HALL, callback?: Callback<HallResponse>): void; 876 877 /** 878 * Unsubscribe to heart rate sensor data. 879 * @permission ohos.permission.READ_HEALTH_DATA 880 * @param { SensorId.HEART_RATE } type - Indicate the sensor type to listen for, {@code SensorId.HEART_RATE}. 881 * @param { Callback<HeartRateResponse> } callback - callback heart rate data. 882 * @throws { BusinessError } 201 - Permission denied. 883 * @throws { BusinessError } 401 - Parameter error. 884 * @syscap SystemCapability.Sensors.Sensor 885 * @since 9 886 */ 887 function off(type: SensorId.HEART_RATE, callback?: Callback<HeartRateResponse>): void; 888 889 /** 890 * Unsubscribe to humidity sensor data. 891 * @param { SensorId.HUMIDITY } type - Indicate the sensor type to listen for, {@code SensorId.HUMIDITY}. 892 * @param { Callback<HumidityResponse> } callback - callback humidity data. 893 * @throws { BusinessError } 401 - Parameter error. 894 * @syscap SystemCapability.Sensors.Sensor 895 * @since 9 896 */ 897 function off(type: SensorId.HUMIDITY, callback?: Callback<HumidityResponse>): void; 898 899 /** 900 * Unsubscribe to linear acceleration sensor data. 901 * @permission ohos.permission.ACCELEROMETER 902 * @param { SensorId.LINEAR_ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.LINEAR_ACCELEROMETER}. 903 * @param { Callback<LinearAccelerometerResponse> } callback - callback linear acceleration data. 904 * @throws { BusinessError } 201 - Permission denied. 905 * @throws { BusinessError } 401 - Parameter error. 906 * @syscap SystemCapability.Sensors.Sensor 907 * @since 9 908 */ 909 function off(type: SensorId.LINEAR_ACCELEROMETER, callback?: Callback<LinearAccelerometerResponse>): void; 910 911 /** 912 * Unsubscribe to magnetic field sensor data. 913 * @param { SensorId.MAGNETIC_FIELD } type - Indicate the sensor type to listen for, {@code SensorId.MAGNETIC_FIELD}. 914 * @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data. 915 * @throws { BusinessError } 401 - Parameter error. 916 * @syscap SystemCapability.Sensors.Sensor 917 * @since 9 918 */ 919 function off(type: SensorId.MAGNETIC_FIELD, callback?: Callback<MagneticFieldResponse>): void; 920 921 /** 922 * Unsubscribe to uncalibrated magnetic field sensor data. 923 * @param { SensorId.MAGNETIC_FIELD_UNCALIBRATED } type - Indicate the sensor type to listen for, 924 * {@code SensorId.MAGNETIC_FIELD_UNCALIBRATED}. 925 * @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback uncalibrated magnetic field data. 926 * @throws { BusinessError } 401 - Parameter error. 927 * @syscap SystemCapability.Sensors.Sensor 928 * @since 9 929 */ 930 function off(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback?: Callback<MagneticFieldUncalibratedResponse>): void; 931 932 /** 933 * Unsubscribe to orientation sensor data. 934 * @param { SensorId.ORIENTATION } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}. 935 * @param { Callback<OrientationResponse> } callback - callback orientation data. 936 * @throws { BusinessError } 401 - Parameter error. 937 * @syscap SystemCapability.Sensors.Sensor 938 * @since 9 939 */ 940 function off(type: SensorId.ORIENTATION, callback?: Callback<OrientationResponse>): void; 941 942 /** 943 * Unsubscribe to pedometer sensor data. 944 * @permission ohos.permission.ACTIVITY_MOTION 945 * @param { SensorId.PEDOMETER } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER}. 946 * @param { Callback<PedometerResponse> } callback - callback pedometer data. 947 * @throws { BusinessError } 201 - Permission denied. 948 * @throws { BusinessError } 401 - Parameter error. 949 * @syscap SystemCapability.Sensors.Sensor 950 * @since 9 951 */ 952 function off(type: SensorId.PEDOMETER, callback?: Callback<PedometerResponse>): void; 953 954 /** 955 * Unsubscribe to pedometer detection sensor data. 956 * @permission ohos.permission.ACTIVITY_MOTION 957 * @param { SensorId.PEDOMETER_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER_DETECTION}. 958 * @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data. 959 * @throws { BusinessError } 201 - Permission denied. 960 * @throws { BusinessError } 401 - Parameter error. 961 * @syscap SystemCapability.Sensors.Sensor 962 * @since 9 963 */ 964 function off(type: SensorId.PEDOMETER_DETECTION, callback?: Callback<PedometerDetectionResponse>): void; 965 966 /** 967 * Unsubscribe to proximity sensor data. 968 * @param { SensorId.PROXIMITY } type - Indicate the sensor type to listen for, {@code SensorId.PROXIMITY}. 969 * @param { Callback<ProximityResponse> } callback - callback proximity data. 970 * @throws { BusinessError } 401 - Parameter error. 971 * @syscap SystemCapability.Sensors.Sensor 972 * @since 9 973 */ 974 function off(type: SensorId.PROXIMITY, callback?: Callback<ProximityResponse>): void; 975 976 /** 977 * Unsubscribe to rotation vector sensor data. 978 * @param { SensorId.ROTATION_VECTOR } type - Indicate the sensor type to listen for, {@code SensorId.ROTATION_VECTOR}. 979 * @param { Callback<RotationVectorResponse> } callback - callback rotation vector data. 980 * @throws { BusinessError } 401 - Parameter error. 981 * @syscap SystemCapability.Sensors.Sensor 982 * @since 9 983 */ 984 function off(type: SensorId.ROTATION_VECTOR, callback?: Callback<RotationVectorResponse>): void; 985 986 /** 987 * Unsubscribe to significant motion sensor data. 988 * @param { SensorId.SIGNIFICANT_MOTION } type - Indicate the sensor type to listen for, {@code SensorId.SIGNIFICANT_MOTION}. 989 * @param { Callback<SignificantMotionResponse> } callback - callback significant motion data. 990 * @throws { BusinessError } 401 - Parameter error. 991 * @syscap SystemCapability.Sensors.Sensor 992 * @since 9 993 */ 994 function off(type: SensorId.SIGNIFICANT_MOTION, callback?: Callback<SignificantMotionResponse>): void; 995 996 /** 997 * Unsubscribe to wear detection sensor data. 998 * @param { SensorId.WEAR_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.WEAR_DETECTION}. 999 * @param { Callback<WearDetectionResponse> } callback - callback wear detection data. 1000 * @throws { BusinessError } 401 - Parameter error. 1001 * @syscap SystemCapability.Sensors.Sensor 1002 * @since 9 1003 */ 1004 function off(type: SensorId.WEAR_DETECTION, callback?: Callback<WearDetectionResponse>): void; 1005 1006 /** 1007 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1008 * @permission ohos.permission.ACCELEROMETER 1009 * @param { SensorType.SENSOR_TYPE_ID_ACCELEROMETER } type - Indicate the sensor type to listen for, 1010 * {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}. 1011 * @param { Callback<AccelerometerResponse> } callback - callback accelerometer data. 1012 * @param { Options } options - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1013 * @syscap SystemCapability.Sensors.Sensor 1014 * @since 8 1015 * @deprecated since 9 1016 * @useinstead sensor.SensorId#ACCELEROMETER 1017 */ 1018 function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<AccelerometerResponse>, 1019 options?: Options): void; 1020 1021 /** 1022 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1023 * @permission ohos.permission.ACCELEROMETER 1024 * @param { SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED } type - Indicate the sensor type to listen for, 1025 * {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}. 1026 * @param { Callback<AccelerometerUncalibratedResponse> } callback - callback accelerometer uncalibrated data. 1027 * @param { Options } options - Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1028 * @syscap SystemCapability.Sensors.Sensor 1029 * @since 8 1030 * @deprecated since 9 1031 * @useinstead sensor.SensorId#ACCELEROMETER_UNCALIBRATED 1032 */ 1033 function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>, 1034 options?: Options): void; 1035 1036 /** 1037 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1038 * @param { SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT } type - type Indicate the sensor type to listen for, 1039 * {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}. 1040 * @param { Callback<LightResponse> } callback - callback light data. 1041 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1042 * @syscap SystemCapability.Sensors.Sensor 1043 * @since 8 1044 * @deprecated since 9 1045 * @useinstead sensor.SensorId#AMBIENT_LIGHT 1046 */ 1047 function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback<LightResponse>, 1048 options?: Options): void; 1049 1050 /** 1051 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1052 * @param { SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE } type - type Indicate the sensor type to listen for, 1053 * {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}. 1054 * @param { Callback<AmbientTemperatureResponse> } callback - callback ambient temperature data. 1055 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1056 * @syscap SystemCapability.Sensors.Sensor 1057 * @since 8 1058 * @deprecated since 9 1059 * @useinstead sensor.SensorId#AMBIENT_TEMPERATURE 1060 */ 1061 function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>, 1062 options?: Options): void; 1063 1064 /** 1065 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1066 * @param { SensorType.SENSOR_TYPE_ID_BAROMETER } type - type Indicate the sensor type to listen for, 1067 * {@code SensorType.SENSOR_TYPE_ID_BAROMETER}. 1068 * @param { Callback<BarometerResponse> } callback - callback barometer data. 1069 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1070 * @syscap SystemCapability.Sensors.Sensor 1071 * @since 8 1072 * @deprecated since 9 1073 * @useinstead sensor.SensorId#BAROMETER 1074 */ 1075 function on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback<BarometerResponse>, 1076 options?: Options): void; 1077 1078 /** 1079 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1080 * @param { SensorType.SENSOR_TYPE_ID_GRAVITY } type - type Indicate the sensor type to listen for, 1081 * {@code SensorType.SENSOR_TYPE_ID_GRAVITY}. 1082 * @param { Callback<GravityResponse> } callback - callback gravity data. 1083 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1084 * @syscap SystemCapability.Sensors.Sensor 1085 * @since 8 1086 * @deprecated since 9 1087 * @useinstead sensor.SensorId#GRAVITY 1088 */ 1089 function on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback<GravityResponse>, 1090 options?: Options): void; 1091 1092 /** 1093 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1094 * @permission ohos.permission.GYROSCOPE 1095 * @param { SensorType.SENSOR_TYPE_ID_GYROSCOPE } type - type Indicate the sensor type to listen for, 1096 * {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}. 1097 * @param { Callback<GyroscopeResponse> } callback - callback gyroscope data. 1098 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1099 * @syscap SystemCapability.Sensors.Sensor 1100 * @since 8 1101 * @deprecated since 9 1102 * @useinstead sensor.SensorId#GYROSCOPE 1103 */ 1104 function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback<GyroscopeResponse>, 1105 options?: Options): void; 1106 1107 /** 1108 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1109 * @permission ohos.permission.GYROSCOPE 1110 * @param { SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED } type - type Indicate the sensor type to listen for, 1111 * {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}. 1112 * @param { Callback<GyroscopeUncalibratedResponse> } callback - callback gyroscope uncalibrated data. 1113 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1114 * @syscap SystemCapability.Sensors.Sensor 1115 * @since 8 1116 * @deprecated since 9 1117 * @useinstead sensor.SensorId#GYROSCOPE_UNCALIBRATED 1118 */ 1119 function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>, 1120 options?: Options): void; 1121 1122 /** 1123 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1124 * @param { SensorType.SENSOR_TYPE_ID_HALL } type - type Indicate the sensor type to listen for, 1125 * {@code SensorType.SENSOR_TYPE_ID_HALL}. 1126 * @param { Callback<HallResponse> } callback - callback hall data. 1127 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1128 * @syscap SystemCapability.Sensors.Sensor 1129 * @since 8 1130 * @deprecated since 9 1131 * @useinstead sensor.SensorId#HALL 1132 */ 1133 function on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback<HallResponse>, 1134 options?: Options): void; 1135 1136 /** 1137 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1138 * @permission ohos.permission.HEALTH_DATA 1139 * @param { SensorType.SENSOR_TYPE_ID_HEART_RATE } type - type Indicate the sensor type to listen for, 1140 * {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}. 1141 * @param { Callback<HeartRateResponse> } callback - callback heart rate data. 1142 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1143 * @syscap SystemCapability.Sensors.Sensor 1144 * @since 8 1145 * @deprecated since 9 1146 * @useinstead sensor.SensorId#HEART_RATE 1147 */ 1148 function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRateResponse>, 1149 options?: Options): void; 1150 1151 /** 1152 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1153 * @param { SensorType.SENSOR_TYPE_ID_HUMIDITY } type - type Indicate the sensor type to listen for, 1154 * {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}. 1155 * @param { Callback<HumidityResponse> } callback - callback humidity data. 1156 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1157 * @syscap SystemCapability.Sensors.Sensor 1158 * @since 8 1159 * @deprecated since 9 1160 * @useinstead sensor.SensorId#HUMIDITY 1161 */ 1162 function on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback<HumidityResponse>, 1163 options?: Options): void; 1164 1165 /** 1166 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1167 * @permission ohos.permission.ACCELEROMETER 1168 * @param { SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION } type - type Indicate the sensor type to listen for, 1169 * {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}. 1170 * @param { Callback<LinearAccelerometerResponse> } callback - callback linear accelerometer data. 1171 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1172 * @syscap SystemCapability.Sensors.Sensor 1173 * @since 8 1174 * @deprecated since 9 1175 * @useinstead sensor.SensorId#LINEAR_ACCELEROMETER 1176 */ 1177 function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback<LinearAccelerometerResponse>, 1178 options?: Options): void; 1179 1180 /** 1181 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1182 * @param { SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD } type - type Indicate the sensor type to listen for, 1183 * {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}. 1184 * @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data. 1185 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1186 * @syscap SystemCapability.Sensors.Sensor 1187 * @since 8 1188 * @deprecated since 9 1189 * @useinstead sensor.SensorId#MAGNETIC_FIELD 1190 */ 1191 function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>, 1192 options?: Options): void; 1193 1194 /** 1195 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1196 * @param { SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED } type - type Indicate the sensor type to listen for, 1197 * {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}. 1198 * @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback magnetic field uncalibrated data. 1199 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1200 * @syscap SystemCapability.Sensors.Sensor 1201 * @since 8 1202 * @deprecated since 9 1203 * @useinstead sensor.SensorId#MAGNETIC_FIELD_UNCALIBRATED 1204 */ 1205 function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>, 1206 options?: Options): void; 1207 1208 /** 1209 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1210 * @param { SensorType.SENSOR_TYPE_ID_ORIENTATION } type - type Indicate the sensor type to listen for, 1211 * {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}. 1212 * @param { Callback<OrientationResponse> } callback - callback orientation data. 1213 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1214 * @syscap SystemCapability.Sensors.Sensor 1215 * @since 8 1216 * @deprecated since 9 1217 * @useinstead sensor.SensorId#ORIENTATION 1218 */ 1219 function on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback<OrientationResponse>, 1220 options?: Options): void; 1221 1222 /** 1223 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1224 * @permission ohos.permission.ACTIVITY_MOTION 1225 * @param { SensorType.SENSOR_TYPE_ID_PEDOMETER } type - type Indicate the sensor type to listen for, 1226 * {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}. 1227 * @param { Callback<PedometerResponse> } callback - callback pedometer data. 1228 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1229 * @syscap SystemCapability.Sensors.Sensor 1230 * @since 8 1231 * @deprecated since 9 1232 * @useinstead sensor.SensorId#PEDOMETER 1233 */ 1234 function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback<PedometerResponse>, 1235 options?: Options): void; 1236 1237 /** 1238 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1239 * @permission ohos.permission.ACTIVITY_MOTION 1240 * @param { SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION } type - type Indicate the sensor type to listen for, 1241 * {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}. 1242 * @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data. 1243 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1244 * @syscap SystemCapability.Sensors.Sensor 1245 * @since 8 1246 * @deprecated since 9 1247 * @useinstead sensor.SensorId#PEDOMETER_DETECTION 1248 */ 1249 function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>, 1250 options?: Options): void; 1251 1252 /** 1253 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1254 * @param { SensorType.SENSOR_TYPE_ID_PROXIMITY } type - type Indicate the sensor type to listen for, 1255 * {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}. 1256 * @param { Callback<ProximityResponse> } callback - callback proximity data. 1257 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1258 * @syscap SystemCapability.Sensors.Sensor 1259 * @since 8 1260 * @deprecated since 9 1261 * @useinstead sensor.SensorId#PROXIMITY 1262 */ 1263 function on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback<ProximityResponse>, 1264 options?: Options): void; 1265 1266 /** 1267 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1268 * @param { SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR } type - type Indicate the sensor type to listen for, 1269 * {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}. 1270 * @param { Callback<RotationVectorResponse> } callback - callback rotation vector data. 1271 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1272 * @syscap SystemCapability.Sensors.Sensor 1273 * @since 8 1274 * @deprecated since 9 1275 * @useinstead sensor.SensorId#ROTATION_VECTOR 1276 */ 1277 function on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback<RotationVectorResponse>, 1278 options?: Options): void; 1279 1280 /** 1281 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1282 * @param { SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION } type - type Indicate the sensor type to listen for, 1283 * {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}. 1284 * @param { Callback<SignificantMotionResponse> } callback - callback significant motion data. 1285 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1286 * @syscap SystemCapability.Sensors.Sensor 1287 * @since 8 1288 * @deprecated since 9 1289 * @useinstead sensor.SensorId#SIGNIFICANT_MOTION 1290 */ 1291 function on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>, 1292 options?: Options): void; 1293 1294 /** 1295 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 1296 * @param { SensorType.SENSOR_TYPE_ID_WEAR_DETECTION } type - type Indicate the sensor type to listen for, 1297 * {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}. 1298 * @param { Callback<WearDetectionResponse> } callback - callback wear detection data. 1299 * @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 1300 * @syscap SystemCapability.Sensors.Sensor 1301 * @since 8 1302 * @deprecated since 9 1303 * @useinstead sensor.SensorId#WEAR_DETECTION 1304 */ 1305 function on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback<WearDetectionResponse>, 1306 options?: Options): void; 1307 1308 /** 1309 * Subscribe to sensor data once. 1310 * @permission ohos.permission.ACCELEROMETER 1311 * @param { SensorType.SENSOR_TYPE_ID_ACCELEROMETER } type - type Indicate the sensor type to listen for, 1312 * {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}. 1313 * @param { Callback<AccelerometerResponse> } callback - callback accelerometer data. 1314 * @syscap SystemCapability.Sensors.Sensor 1315 * @since 8 1316 * @deprecated since 9 1317 * @useinstead sensor.SensorId#ACCELEROMETER 1318 */ 1319 function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<AccelerometerResponse>): void; 1320 1321 /** 1322 * Subscribe to sensor data once. 1323 * @permission ohos.permission.ACCELEROMETER 1324 * @param { SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED } type - type Indicate the sensor type to listen for, 1325 * {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}. 1326 * @param { Callback<AccelerometerUncalibratedResponse> } callback - callback accelerometer uncalibrated data. 1327 * @syscap SystemCapability.Sensors.Sensor 1328 * @since 8 1329 * @deprecated since 9 1330 * @useinstead sensor.SensorId#ACCELEROMETER_UNCALIBRATED 1331 */ 1332 function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>): void; 1333 1334 /** 1335 * Subscribe to sensor data once. 1336 * @param { SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT } type - type Indicate the sensor type to listen for, 1337 * {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}. 1338 * @param { Callback<LightResponse> } callback - callback light data. 1339 * @syscap SystemCapability.Sensors.Sensor 1340 * @since 8 1341 * @deprecated since 9 1342 * @useinstead sensor.SensorId#AMBIENT_LIGHT 1343 */ 1344 function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback<LightResponse>): void; 1345 1346 /** 1347 * Subscribe to sensor data once. 1348 * @param { SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE } type - type Indicate the sensor type to listen for, 1349 * {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}. 1350 * @param { Callback<AmbientTemperatureResponse> } callback - callback ambient temperature data. 1351 * @syscap SystemCapability.Sensors.Sensor 1352 * @since 8 1353 * @deprecated since 9 1354 * @useinstead sensor.SensorId#AMBIENT_TEMPERATURE 1355 */ 1356 function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>): void; 1357 1358 /** 1359 * Subscribe to sensor data once. 1360 * @param { SensorType.SENSOR_TYPE_ID_BAROMETER } type - type Indicate the sensor type to listen for, 1361 * {@code SensorType.SENSOR_TYPE_ID_BAROMETER}. 1362 * @param { Callback<BarometerResponse> } callback - callback barometer data. 1363 * @syscap SystemCapability.Sensors.Sensor 1364 * @since 8 1365 * @deprecated since 9 1366 * @useinstead sensor.SensorId#BAROMETER 1367 */ 1368 function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback<BarometerResponse>): void; 1369 1370 /** 1371 * Subscribe to sensor data once. 1372 * @param { SensorType.SENSOR_TYPE_ID_GRAVITY } type - type Indicate the sensor type to listen for, 1373 * {@code SensorType.SENSOR_TYPE_ID_GRAVITY}. 1374 * @param { Callback<GravityResponse> } callback - callback gravity data. 1375 * @syscap SystemCapability.Sensors.Sensor 1376 * @since 8 1377 * @deprecated since 9 1378 * @useinstead sensor.SensorId#GRAVITY 1379 */ 1380 function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback<GravityResponse>): void; 1381 1382 /** 1383 * Subscribe to sensor data once. 1384 * @permission ohos.permission.GYROSCOPE 1385 * @param { SensorType.SENSOR_TYPE_ID_GYROSCOPE } type - type Indicate the sensor type to listen for, 1386 * {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}. 1387 * @param { Callback<GyroscopeResponse> } callback - callback gyroscope data. 1388 * @syscap SystemCapability.Sensors.Sensor 1389 * @since 8 1390 * @deprecated since 9 1391 * @useinstead sensor.SensorId#GYROSCOPE 1392 */ 1393 function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback<GyroscopeResponse>): void; 1394 1395 /** 1396 * Subscribe to sensor data once. 1397 * @permission ohos.permission.GYROSCOPE 1398 * @param { SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED } type - type Indicate the sensor type to listen for, 1399 * {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}. 1400 * @param { Callback<GyroscopeUncalibratedResponse> } callback - callback gyroscope uncalibrated data. 1401 * @syscap SystemCapability.Sensors.Sensor 1402 * @since 8 1403 * @deprecated since 9 1404 * @useinstead sensor.SensorId#GYROSCOPE_UNCALIBRATED 1405 */ 1406 function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>): void; 1407 1408 /** 1409 * Subscribe to sensor data once. 1410 * @param { SensorType.SENSOR_TYPE_ID_HALL } type - type Indicate the sensor type to listen for, 1411 * {@code SensorType.SENSOR_TYPE_ID_HALL}. 1412 * @param { Callback<HallResponse> } callback - callback hall data. 1413 * @syscap SystemCapability.Sensors.Sensor 1414 * @since 8 1415 * @deprecated since 9 1416 * @useinstead sensor.SensorId#HALL 1417 */ 1418 function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback<HallResponse>): void; 1419 1420 /** 1421 * Subscribe to sensor data once. 1422 * @permission ohos.permission.HEART_RATE 1423 * @param { SensorType.SENSOR_TYPE_ID_HEART_RATE } type - type Indicate the sensor type to listen for, 1424 * {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}. 1425 * @param { Callback<HeartRateResponse> } callback - callback heart rate data. 1426 * @syscap SystemCapability.Sensors.Sensor 1427 * @since 8 1428 * @deprecated since 9 1429 * @useinstead sensor.SensorId#HEART_RATE 1430 */ 1431 function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRateResponse>): void; 1432 1433 /** 1434 * Subscribe to sensor data once. 1435 * @param { SensorType.SENSOR_TYPE_ID_HUMIDITY } type - type Indicate the sensor type to listen for, 1436 * {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}. 1437 * @param { Callback<HumidityResponse> } callback - callback humidity data. 1438 * @syscap SystemCapability.Sensors.Sensor 1439 * @since 8 1440 * @deprecated since 9 1441 * @useinstead sensor.SensorId#HUMIDITY 1442 */ 1443 function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback<HumidityResponse>): void; 1444 1445 /** 1446 * Subscribe to sensor data once. 1447 * @permission ohos.permission.ACCELERATION 1448 * @param { SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION } type - type Indicate the sensor type to listen for, 1449 * {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}. 1450 * @param { Callback<LinearAccelerometerResponse> } callback - callback linear accelerometer data. 1451 * @syscap SystemCapability.Sensors.Sensor 1452 * @since 8 1453 * @deprecated since 9 1454 * @useinstead sensor.SensorId#LINEAR_ACCELEROMETER 1455 */ 1456 function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback<LinearAccelerometerResponse>): void; 1457 1458 /** 1459 * Subscribe to sensor data once. 1460 * @param { SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD } type - type Indicate the sensor type to listen for, 1461 * {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}. 1462 * @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data. 1463 * @syscap SystemCapability.Sensors.Sensor 1464 * @since 8 1465 * @deprecated since 9 1466 * @useinstead sensor.SensorId#MAGNETIC_FIELD 1467 */ 1468 function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>): void; 1469 1470 /** 1471 * Subscribe to sensor data once. 1472 * @param { SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED } type - type Indicate the sensor type to listen for, 1473 * {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}. 1474 * @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback magnetic field uncalibrated data. 1475 * @syscap SystemCapability.Sensors.Sensor 1476 * @since 8 1477 * @deprecated since 9 1478 * @useinstead sensor.SensorId#MAGNETIC_FIELD_UNCALIBRATED 1479 */ 1480 function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>): void; 1481 1482 /** 1483 * Subscribe to sensor data once. 1484 * @param { SensorType.SENSOR_TYPE_ID_ORIENTATION } type - type Indicate the sensor type to listen for, 1485 * {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}. 1486 * @param { Callback<OrientationResponse> } callback - callback orientation data. 1487 * @syscap SystemCapability.Sensors.Sensor 1488 * @since 8 1489 * @deprecated since 9 1490 * @useinstead sensor.SensorId#ORIENTATION 1491 */ 1492 function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback<OrientationResponse>): void; 1493 1494 /** 1495 * Subscribe to sensor data once. 1496 * @permission ohos.permission.ACTIVITY_MOTION 1497 * @param { SensorType.SENSOR_TYPE_ID_PEDOMETER } type - type Indicate the sensor type to listen for, 1498 * {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}. 1499 * @param { Callback<PedometerResponse> } callback - callback pedometer data. 1500 * @syscap SystemCapability.Sensors.Sensor 1501 * @since 8 1502 * @deprecated since 9 1503 * @useinstead sensor.SensorId#PEDOMETER 1504 */ 1505 function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback<PedometerResponse>): void; 1506 1507 /** 1508 * Subscribe to sensor data once. 1509 * @permission ohos.permission.ACTIVITY_MOTION 1510 * @param { SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION } type - type Indicate the sensor type to listen for, 1511 * {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}. 1512 * @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data. 1513 * @syscap SystemCapability.Sensors.Sensor 1514 * @since 8 1515 * @deprecated since 9 1516 * @useinstead sensor.SensorId#PEDOMETER_DETECTION 1517 */ 1518 function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>): void; 1519 1520 /** 1521 * Subscribe to sensor data once. 1522 * @param { SensorType.SENSOR_TYPE_ID_PROXIMITY } type - type Indicate the sensor type to listen for, 1523 * {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}. 1524 * @param { Callback<ProximityResponse> } callback - callback proximity data. 1525 * @syscap SystemCapability.Sensors.Sensor 1526 * @since 8 1527 * @deprecated since 9 1528 * @useinstead sensor.SensorId#PROXIMITY 1529 */ 1530 function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback<ProximityResponse>): void; 1531 1532 /** 1533 * Subscribe to sensor data once. 1534 * @param { SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR } type - type Indicate the sensor type to listen for, 1535 * {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}. 1536 * @param { Callback<RotationVectorResponse> } callback - callback rotation vector data. 1537 * @syscap SystemCapability.Sensors.Sensor 1538 * @since 8 1539 * @deprecated since 9 1540 * @useinstead sensor.SensorId#ROTATION_VECTOR 1541 */ 1542 function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback<RotationVectorResponse>): void; 1543 1544 /** 1545 * Subscribe to sensor data once. 1546 * @param { SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION } type - type Indicate the sensor type to listen for, 1547 * {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}. 1548 * @param { Callback<SignificantMotionResponse> } callback - callback significant motion data. 1549 * @syscap SystemCapability.Sensors.Sensor 1550 * @since 8 1551 * @deprecated since 9 1552 * @useinstead sensor.SensorId#SIGNIFICANT_MOTION 1553 */ 1554 function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>): void; 1555 1556 /** 1557 * Subscribe to sensor data once. 1558 * @param { SensorType.SENSOR_TYPE_ID_WEAR_DETECTION } type - type Indicate the sensor type to listen for, 1559 * {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}. 1560 * @param { Callback<WearDetectionResponse> } callback - callback wear detection data. 1561 * @syscap SystemCapability.Sensors.Sensor 1562 * @since 8 1563 * @deprecated since 9 1564 * @useinstead sensor.SensorId#WEAR_DETECTION 1565 */ 1566 function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback<WearDetectionResponse>): void; 1567 1568 /** 1569 * Unsubscribe to sensor data. 1570 * @permission ohos.permission.ACCELEROMETER 1571 * @param { SensorType.SENSOR_TYPE_ID_ACCELEROMETER } type - type Indicate the sensor type to unsubscribe, 1572 * {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}. 1573 * @param { Callback<AccelerometerResponse> } callback - callback accelerometer data. 1574 * @syscap SystemCapability.Sensors.Sensor 1575 * @since 8 1576 * @deprecated since 9 1577 * @useinstead sensor.SensorId#ACCELEROMETER 1578 */ 1579 function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback?: Callback<AccelerometerResponse>): void; 1580 1581 /** 1582 * Unsubscribe to sensor data. 1583 * @permission ohos.permission.ACCELEROMETER 1584 * @param { SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED } type - type Indicate the sensor type to unsubscribe, 1585 * {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}. 1586 * @param { Callback<AccelerometerUncalibratedResponse> } callback - callback accelerometer uncalibrated data. 1587 * @syscap SystemCapability.Sensors.Sensor 1588 * @since 8 1589 * @deprecated since 9 1590 * @useinstead sensor.SensorId#ACCELEROMETER_UNCALIBRATED 1591 */ 1592 function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, 1593 callback?: Callback<AccelerometerUncalibratedResponse>): void; 1594 1595 /** 1596 * Unsubscribe to sensor data. 1597 * @param { SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT } type - type Indicate the sensor type to unsubscribe, 1598 * {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}. 1599 * @param { Callback<LightResponse> } callback - callback light data. 1600 * @syscap SystemCapability.Sensors.Sensor 1601 * @since 8 1602 * @deprecated since 9 1603 * @useinstead sensor.SensorId#AMBIENT_LIGHT 1604 */ 1605 function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback?: Callback<LightResponse>): void; 1606 1607 /** 1608 * Unsubscribe to sensor data. 1609 * @param { SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE } type - type Indicate the sensor type to unsubscribe, 1610 * {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}. 1611 * @param { Callback<AmbientTemperatureResponse> } callback - callback ambient temperature data. 1612 * @syscap SystemCapability.Sensors.Sensor 1613 * @since 8 1614 * @deprecated since 9 1615 * @useinstead sensor.SensorId#AMBIENT_TEMPERATURE 1616 */ 1617 function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback?: Callback<AmbientTemperatureResponse>): void; 1618 1619 /** 1620 * Unsubscribe to sensor data. 1621 * @param { SensorType.SENSOR_TYPE_ID_BAROMETER } type - type Indicate the sensor type to unsubscribe, 1622 * {@code SensorType.SENSOR_TYPE_ID_BAROMETER}. 1623 * @param { Callback<BarometerResponse> } callback - callback barometer response data. 1624 * @syscap SystemCapability.Sensors.Sensor 1625 * @since 8 1626 * @deprecated since 9 1627 * @useinstead sensor.SensorId#BAROMETER 1628 */ 1629 function off(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback?: Callback<BarometerResponse>): void; 1630 1631 /** 1632 * Unsubscribe to sensor data. 1633 * @param { SensorType.SENSOR_TYPE_ID_GRAVITY } type - type Indicate the sensor type to unsubscribe, 1634 * {@code SensorType.SENSOR_TYPE_ID_GRAVITY}. 1635 * @param { Callback<GravityResponse> } callback - callback gravity data. 1636 * @syscap SystemCapability.Sensors.Sensor 1637 * @since 8 1638 * @deprecated since 9 1639 * @useinstead sensor.SensorId#GRAVITY 1640 */ 1641 function off(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback?: Callback<GravityResponse>): void; 1642 1643 /** 1644 * Unsubscribe to sensor data. 1645 * @permission ohos.permission.GYROSCOPE 1646 * @param { SensorType.SENSOR_TYPE_ID_GYROSCOPE } type - type Indicate the sensor type to unsubscribe, 1647 * {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}. 1648 * @param { Callback<GyroscopeResponse> } callback - callback gyroscope data. 1649 * @syscap SystemCapability.Sensors.Sensor 1650 * @since 8 1651 * @deprecated since 9 1652 * @useinstead sensor.SensorId#GYROSCOPE 1653 */ 1654 function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback?: Callback<GyroscopeResponse>): void; 1655 1656 /** 1657 * Unsubscribe to sensor data. 1658 * @permission ohos.permission.GYROSCOPE 1659 * @param { SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED } type - type Indicate the sensor type to unsubscribe, 1660 * {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}. 1661 * @param { Callback<GyroscopeUncalibratedResponse> } callback - callback gyroscope uncalibrated data. 1662 * @syscap SystemCapability.Sensors.Sensor 1663 * @since 8 1664 * @deprecated since 9 1665 * @useinstead sensor.SensorId#GYROSCOPE_UNCALIBRATED 1666 */ 1667 function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback<GyroscopeUncalibratedResponse>): void; 1668 1669 /** 1670 * Unsubscribe to sensor data. 1671 * @param { SensorType.SENSOR_TYPE_ID_HALL } type - type Indicate the sensor type to unsubscribe, 1672 * {@code SensorType.SENSOR_TYPE_ID_HALL}. 1673 * @param { Callback<HallResponse> } callback - callback hall data. 1674 * @syscap SystemCapability.Sensors.Sensor 1675 * @since 8 1676 * @deprecated since 9 1677 * @useinstead sensor.SensorId#HALL 1678 */ 1679 function off(type: SensorType.SENSOR_TYPE_ID_HALL, callback?: Callback<HallResponse>): void; 1680 1681 /** 1682 * Unsubscribe to sensor data. 1683 * @permission ohos.permission.HEALTH_DATA 1684 * @param { SensorType.SENSOR_TYPE_ID_HEART_RATE } type - type Indicate the sensor type to unsubscribe, 1685 * {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}. 1686 * @param { Callback<HeartRateResponse> } callback - callback heart rate data. 1687 * @syscap SystemCapability.Sensors.Sensor 1688 * @since 8 1689 * @deprecated since 9 1690 * @useinstead sensor.SensorId#HEART_RATE 1691 */ 1692 function off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback<HeartRateResponse>): void; 1693 1694 /** 1695 * Unsubscribe to sensor data. 1696 * @param { SensorType.SENSOR_TYPE_ID_HUMIDITY } type - type Indicate the sensor type to unsubscribe, 1697 * {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}. 1698 * @param { Callback<HumidityResponse> } callback - callback humidity data. 1699 * @syscap SystemCapability.Sensors.Sensor 1700 * @since 8 1701 * @deprecated since 9 1702 * @useinstead sensor.SensorId#HUMIDITY 1703 */ 1704 function off(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback?: Callback<HumidityResponse>): void; 1705 1706 /** 1707 * Unsubscribe to sensor data. 1708 * @permission ohos.permission.ACCELEROMETER 1709 * @param { SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION } type - type Indicate the sensor type to unsubscribe, 1710 * {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}. 1711 * @param { Callback<LinearAccelerometerResponse> } callback - callback linear accelerometer data. 1712 * @syscap SystemCapability.Sensors.Sensor 1713 * @since 8 1714 * @deprecated since 9 1715 * @useinstead sensor.SensorId#LINEAR_ACCELEROMETER 1716 */ 1717 function off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback<LinearAccelerometerResponse>): void; 1718 1719 /** 1720 * Unsubscribe to sensor data. 1721 * @param { SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD } type - type Indicate the sensor type to unsubscribe, 1722 * {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}. 1723 * @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data. 1724 * @syscap SystemCapability.Sensors.Sensor 1725 * @since 8 1726 * @deprecated since 9 1727 * @useinstead sensor.SensorId#MAGNETIC_FIELD 1728 */ 1729 function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback?: Callback<MagneticFieldResponse>): void; 1730 1731 /** 1732 * Unsubscribe to sensor data. 1733 * @param { SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED } type - type Indicate the sensor type to unsubscribe, 1734 * {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}. 1735 * @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback magnetic field uncalibrated data. 1736 * @syscap SystemCapability.Sensors.Sensor 1737 * @since 8 1738 * @deprecated since 9 1739 * @useinstead sensor.SensorId#MAGNETIC_FIELD_UNCALIBRATED 1740 */ 1741 function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback?: Callback<MagneticFieldUncalibratedResponse>): void; 1742 1743 /** 1744 * Unsubscribe to sensor data. 1745 * @param { SensorType.SENSOR_TYPE_ID_ORIENTATION } type - type Indicate the sensor type to unsubscribe, 1746 * {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}. 1747 * @param { Callback<OrientationResponse> } callback - callback orientation data. 1748 * @syscap SystemCapability.Sensors.Sensor 1749 * @since 8 1750 * @deprecated since 9 1751 * @useinstead sensor.SensorId#ORIENTATION 1752 */ 1753 function off(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback?: Callback<OrientationResponse>): void; 1754 1755 /** 1756 * Unsubscribe to sensor data. 1757 * @permission ohos.permission.ACTIVITY_MOTION 1758 * @param { SensorType.SENSOR_TYPE_ID_PEDOMETER } type - type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}. 1759 * @param { Callback<PedometerResponse> } callback - callback pedometer data. 1760 * @syscap SystemCapability.Sensors.Sensor 1761 * @since 8 1762 * @deprecated since 9 1763 * @useinstead sensor.SensorId#PEDOMETER 1764 */ 1765 function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback?: Callback<PedometerResponse>): void; 1766 1767 /** 1768 * Unsubscribe to sensor data. 1769 * @permission ohos.permission.ACTIVITY_MOTION 1770 * @param { SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION } type - type Indicate the sensor type to unsubscribe, 1771 * {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}. 1772 * @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data. 1773 * @syscap SystemCapability.Sensors.Sensor 1774 * @since 8 1775 * @deprecated since 9 1776 * @useinstead sensor.SensorId#PEDOMETER_DETECTION 1777 */ 1778 function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback?: Callback<PedometerDetectionResponse>): void; 1779 1780 /** 1781 * Unsubscribe to sensor data. 1782 * @param { SensorType.SENSOR_TYPE_ID_PROXIMITY } type - type Indicate the sensor type to unsubscribe, 1783 * {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}. 1784 * @param { Callback<ProximityResponse> } callback - callback proximity data. 1785 * @syscap SystemCapability.Sensors.Sensor 1786 * @since 8 1787 * @deprecated since 9 1788 * @useinstead sensor.SensorId#PROXIMITY 1789 */ 1790 function off(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback?: Callback<ProximityResponse>): void; 1791 1792 /** 1793 * Unsubscribe to sensor data. 1794 * @param { SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR } type - type Indicate the sensor type to unsubscribe, 1795 * {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}. 1796 * @param { Callback<RotationVectorResponse> } callback - callback rotation vector data. 1797 * @syscap SystemCapability.Sensors.Sensor 1798 * @since 8 1799 * @deprecated since 9 1800 * @useinstead sensor.SensorId#ROTATION_VECTOR 1801 */ 1802 function off(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback?: Callback<RotationVectorResponse>): void; 1803 1804 /** 1805 * Unsubscribe to sensor data. 1806 * @param { SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION } type - type Indicate the sensor type to unsubscribe, 1807 * {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}. 1808 * @param { Callback<SignificantMotionResponse> } callback - callback significant motion data. 1809 * @syscap SystemCapability.Sensors.Sensor 1810 * @since 8 1811 * @deprecated since 9 1812 * @useinstead sensor.SensorId#SIGNIFICANT_MOTION 1813 */ 1814 function off(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback?: Callback<SignificantMotionResponse>): void; 1815 1816 /** 1817 * Unsubscribe to sensor data. 1818 * @param { SensorType.SENSOR_TYPE_ID_WEAR_DETECTION } type - type Indicate the sensor type to unsubscribe, 1819 * {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}. 1820 * @param { Callback<WearDetectionResponse> } callback - callback wear detection data. 1821 * @syscap SystemCapability.Sensors.Sensor 1822 * @since 8 1823 * @deprecated since 9 1824 * @useinstead sensor.SensorId#WEAR_DETECTION 1825 */ 1826 function off(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback?: Callback<WearDetectionResponse>): void; 1827 1828 /** 1829 * Indicates sensor information. 1830 * @typedef Sensor 1831 * @syscap SystemCapability.Sensors.Sensor 1832 * @since 9 1833 */ 1834 interface Sensor { 1835 /** 1836 * Sensor name. 1837 * @type { string } 1838 * @syscap SystemCapability.Sensors.Sensor 1839 * @since 9 1840 */ 1841 sensorName:string; 1842 1843 /** 1844 * Sensor vendor. 1845 * @type { string } 1846 * @syscap SystemCapability.Sensors.Sensor 1847 * @since 9 1848 */ 1849 vendorName:string; 1850 1851 /** 1852 * Sensor firmware version. 1853 * @type { string } 1854 * @syscap SystemCapability.Sensors.Sensor 1855 * @since 9 1856 */ 1857 firmwareVersion:string; 1858 1859 /** 1860 * Sensor hardware version. 1861 * @type { string } 1862 * @syscap SystemCapability.Sensors.Sensor 1863 * @since 9 1864 */ 1865 hardwareVersion:string; 1866 1867 /** 1868 * Sensor type ID, {@code SensorType}. 1869 * @type { number } 1870 * @syscap SystemCapability.Sensors.Sensor 1871 * @since 9 1872 */ 1873 sensorId:number; 1874 1875 /** 1876 * Maximum measurement range of the sensor. 1877 * @type { number } 1878 * @syscap SystemCapability.Sensors.Sensor 1879 * @since 9 1880 */ 1881 maxRange:number; 1882 1883 /** 1884 * Minimum sample period allowed, in ns. 1885 * @type { number } 1886 * @syscap SystemCapability.Sensors.Sensor 1887 * @since 9 1888 */ 1889 minSamplePeriod:number; 1890 1891 /** 1892 * Maximum sample period allowed, in ns. 1893 * @type { number } 1894 * @syscap SystemCapability.Sensors.Sensor 1895 * @since 9 1896 */ 1897 maxSamplePeriod:number; 1898 1899 /** 1900 * Sensor accuracy. 1901 * @type { number } 1902 * @syscap SystemCapability.Sensors.Sensor 1903 * @since 9 1904 */ 1905 precision:number; 1906 1907 /** 1908 * Sensor power. 1909 * @type { number } 1910 * @syscap SystemCapability.Sensors.Sensor 1911 * @since 9 1912 */ 1913 power:number; 1914 } 1915 1916 /** 1917 * Obtains the sensor information of a specified type. 1918 * @param { SensorId } type - Indicate the sensor type, {@code SensorId}. 1919 * @param { AsyncCallback<Sensor> } callback - callback sensor info. 1920 * @throws { BusinessError } 401 - Parameter error. 1921 * @throws { BusinessError } 14500101 - Service exception. 1922 * @syscap SystemCapability.Sensors.Sensor 1923 * @since 9 1924 */ 1925 function getSingleSensor(type: SensorId, callback: AsyncCallback<Sensor>): void; 1926 1927 /** 1928 * Obtains the sensor information of a specified type. 1929 * @param { SensorId } type - Indicate the sensor type, {@code SensorId}. 1930 * @returns { Promise<Sensor> } Promise used to return the result. 1931 * @throws { BusinessError } 401 - Parameter error. 1932 * @throws { BusinessError } 14500101 - Service exception. 1933 * @syscap SystemCapability.Sensors.Sensor 1934 * @since 9 1935 */ 1936 function getSingleSensor(type: SensorId): Promise<Sensor>; 1937 1938 /** 1939 * Obtains all sensor information on the device. 1940 * @param { AsyncCallback<Array<Sensor>> } callback - callback sensor list. 1941 * @throws { BusinessError } 401 - Parameter error. 1942 * @throws { BusinessError } 14500101 - Service exception. 1943 * @syscap SystemCapability.Sensors.Sensor 1944 * @since 9 1945 */ 1946 function getSensorList(callback: AsyncCallback<Array<Sensor>>): void; 1947 1948 /** 1949 * Obtains all sensor information on the device. 1950 * @returns { Promise<Array<Sensor>> } Promise used to return the result. 1951 * @throws { BusinessError } 401 - Parameter error. 1952 * @throws { BusinessError } 14500101 - Service exception. 1953 * @syscap SystemCapability.Sensors.Sensor 1954 * @since 9 1955 */ 1956 function getSensorList(): Promise<Array<Sensor>>; 1957 1958 /** 1959 * Indicates geomagnetic field data. 1960 * @typedef GeomagneticResponse 1961 * @syscap SystemCapability.Sensors.Sensor 1962 * @since 8 1963 */ 1964 interface GeomagneticResponse { 1965 /** 1966 * Geomagnetic x-axis component. 1967 * @type { number } 1968 * @syscap SystemCapability.Sensors.Sensor 1969 * @since 8 1970 */ 1971 x: number; 1972 1973 /** 1974 * Geomagnetic y-axis component. 1975 * @type { number } 1976 * @syscap SystemCapability.Sensors.Sensor 1977 * @since 8 1978 */ 1979 y: number; 1980 1981 /** 1982 * Geomagnetic z-axis component. 1983 * @type { number } 1984 * @syscap SystemCapability.Sensors.Sensor 1985 * @since 8 1986 */ 1987 z: number; 1988 1989 /** 1990 * The Angle between the earth's magnetic field lines and the horizontal plane. 1991 * @type { number } 1992 * @syscap SystemCapability.Sensors.Sensor 1993 * @since 8 1994 */ 1995 geomagneticDip: number; 1996 1997 /** 1998 * The Angle of magnetic north and true north on a horizontal plane. 1999 * @type { number } 2000 * @syscap SystemCapability.Sensors.Sensor 2001 * @since 8 2002 */ 2003 deflectionAngle: number; 2004 2005 /** 2006 * The horizontal strength of the geomagnetic field. 2007 * @type { number } 2008 * @syscap SystemCapability.Sensors.Sensor 2009 * @since 8 2010 */ 2011 levelIntensity: number; 2012 2013 /** 2014 * The total strength of the geomagnetic field. 2015 * @type { number } 2016 * @syscap SystemCapability.Sensors.Sensor 2017 * @since 8 2018 */ 2019 totalIntensity: number; 2020 } 2021 2022 /** 2023 * Indicates geographic location. 2024 * @typedef LocationOptions 2025 * @syscap SystemCapability.Sensors.Sensor 2026 * @since 8 2027 */ 2028 interface LocationOptions { 2029 /** 2030 * Specifies the latitude of the point. 2031 * @type { number } 2032 * @syscap SystemCapability.Sensors.Sensor 2033 * @since 8 2034 */ 2035 latitude: number; 2036 2037 /** 2038 * Specifies the longitude of the point. 2039 * @type { number } 2040 * @syscap SystemCapability.Sensors.Sensor 2041 * @since 8 2042 */ 2043 longitude: number; 2044 2045 /** 2046 * Specifies the altitude of the point. 2047 * @type { number } 2048 * @syscap SystemCapability.Sensors.Sensor 2049 * @since 8 2050 */ 2051 altitude: number; 2052 } 2053 2054 /** 2055 * Implements the calculation of the geomagnetic field at a specific location on Earth. 2056 * @param { LocationOptions } locationOptions - Indicates geographic location, {@code LocationOptions}. 2057 * @param { number } timeMillis - Indicates the time at which the magnetic declination is to be obtained, 2058 * in milliseconds since the Unix epoch. 2059 * @param { AsyncCallback<GeomagneticResponse> } callback - callback geomagnetic field. 2060 * @syscap SystemCapability.Sensors.Sensor 2061 * @since 8 2062 * @deprecated since 9 2063 * @useinstead sensor#getGeomagneticInfo 2064 */ 2065 function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback<GeomagneticResponse>): void; 2066 2067 /** 2068 * Implements the calculation of the geomagnetic field at a specific location on Earth. 2069 * @param { LocationOptions } locationOptions - LocationOptions Indicates geographic location, {@code LocationOptions}. 2070 * @param { number } timeMillis - timeMillis Indicates the time at which the magnetic declination is to be obtained, 2071 * in milliseconds since the Unix epoch. 2072 * @returns { Promise<GeomagneticResponse> } Returns the geomagnetic field data, {@code GeomagneticResponse}. 2073 * @syscap SystemCapability.Sensors.Sensor 2074 * @since 8 2075 * @deprecated since 9 2076 * @useinstead sensor#getGeomagneticInfo 2077 */ 2078 function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise<GeomagneticResponse>; 2079 2080 /** 2081 * Obtains the geomagnetic field at a specific location on the Earth. 2082 * @param { LocationOptions } locationOptions - LocationOptions Indicates geographic location, {@code LocationOptions}. 2083 * @param { number } timeMillis - timeMillis Indicates the time at which the magnetic declination is to be obtained, 2084 * in milliseconds since the Unix epoch. 2085 * @param { AsyncCallback<GeomagneticResponse> } callback - callback geomagnetic field. 2086 * @throws { BusinessError } 401 - Parameter error. 2087 * @throws { BusinessError } 14500101 - Service exception. 2088 * @syscap SystemCapability.Sensors.Sensor 2089 * @since 9 2090 */ 2091 function getGeomagneticInfo(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback<GeomagneticResponse>): void; 2092 2093 /** 2094 * Obtains the geomagnetic field at a specific location on the Earth. 2095 * @param { LocationOptions } locationOptions - LocationOptions Indicates geographic location, {@code LocationOptions}. 2096 * @param { number } timeMillis - timeMillis Indicates the time at which the magnetic declination is to be obtained, 2097 * in milliseconds since the Unix epoch. 2098 * @returns { Promise<GeomagneticResponse> } Promise used to return the result. 2099 * @throws { BusinessError } 401 - Parameter error. 2100 * @throws { BusinessError } 14500101 - Service exception. 2101 * @syscap SystemCapability.Sensors.Sensor 2102 * @since 9 2103 */ 2104 function getGeomagneticInfo(locationOptions: LocationOptions, timeMillis: number): Promise<GeomagneticResponse>; 2105 2106 /** 2107 * Obtains the altitude at which the device is located based on the current atmospheric pressure. 2108 * @param { number } seaPressure - Indicates the sea level pressure, in hPa. 2109 * @param { number } currentPressure - Indicates the atmospheric pressure measured by the barometer, in hPa. 2110 * @param { AsyncCallback<number> } callback - callback device altitude. 2111 * @syscap SystemCapability.Sensors.Sensor 2112 * @since 8 2113 * @deprecated since 9 2114 * @useinstead sensor#getDeviceAltitude 2115 */ 2116 function getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback<number>): void; 2117 2118 /** 2119 * Obtains the altitude at which the device is located based on the current atmospheric pressure. 2120 * @param { number } seaPressure - seaPressure Indicates the sea level pressure, in hPa. 2121 * @param { number } currentPressure - currentPressure Indicates the atmospheric pressure measured by the barometer, in hPa. 2122 * @returns { Promise<number> } Returns the altitude in meters at which the device is located. 2123 * @syscap SystemCapability.Sensors.Sensor 2124 * @since 8 2125 * @deprecated since 9 2126 * @useinstead sensor#getDeviceAltitude 2127 */ 2128 function getAltitude(seaPressure: number, currentPressure: number): Promise<number>; 2129 2130 /** 2131 * Obtains the altitude at which the device is located based on the current atmospheric pressure. 2132 * @param { number } seaPressure - seaPressure Indicates the sea level pressure, in hPa. 2133 * @param { number } currentPressure - currentPressure Indicates the atmospheric pressure measured by the barometer, in hPa. 2134 * @param { AsyncCallback<number> } callback - callback device altitude. 2135 * @throws { BusinessError } 401 - Parameter error. 2136 * @throws { BusinessError } 14500101 - Service exception. 2137 * @syscap SystemCapability.Sensors.Sensor 2138 * @since 9 2139 */ 2140 function getDeviceAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback<number>): void; 2141 2142 /** 2143 * Obtains the altitude at which the device is located based on the current atmospheric pressure. 2144 * @param { number } seaPressure - seaPressure Indicates the sea level pressure, in hPa. 2145 * @param { number } currentPressure - currentPressure Indicates the atmospheric pressure measured by the barometer, in hPa. 2146 * @returns { Promise<number> } Promise used to return the result. 2147 * @throws { BusinessError } 401 - Parameter error. 2148 * @throws { BusinessError } 14500101 - Service exception. 2149 * @syscap SystemCapability.Sensors.Sensor 2150 * @since 9 2151 */ 2152 function getDeviceAltitude(seaPressure: number, currentPressure: number): Promise<number>; 2153 2154 /** 2155 * Computes the geomagnetic inclination angle in radians from the inclination matrix. 2156 * @param { Array<number> } inclinationMatrix - Indicates the inclination matrix. 2157 * @param { AsyncCallback<number> } callback - callback geomagnetic inclination data. 2158 * @syscap SystemCapability.Sensors.Sensor 2159 * @since 8 2160 * @deprecated since 9 2161 * @useinstead sensor#getInclination 2162 */ 2163 function getGeomagneticDip(inclinationMatrix: Array<number>, callback: AsyncCallback<number>): void; 2164 2165 /** 2166 * Computes the geomagnetic inclination angle in radians from the inclination matrix. 2167 * @param { Array<number> } inclinationMatrix - Indicates the inclination matrix. 2168 * @returns { Promise<number> } Returns the geomagnetic inclination angle in radians. 2169 * @syscap SystemCapability.Sensors.Sensor 2170 * @since 8 2171 * @deprecated since 9 2172 * @useinstead sensor#getInclination 2173 */ 2174 function getGeomagneticDip(inclinationMatrix: Array<number>): Promise<number>; 2175 2176 /** 2177 * Computes the geomagnetic inclination in radians from the inclination matrix. 2178 * @param { Array<number> } inclinationMatrix - Indicates the inclination matrix. 2179 * @param { AsyncCallback<number> } callback - callback inclination in radians. 2180 * @throws { BusinessError } 401 - Parameter error. 2181 * @throws { BusinessError } 14500101 - Service exception. 2182 * @syscap SystemCapability.Sensors.Sensor 2183 * @since 9 2184 */ 2185 function getInclination(inclinationMatrix: Array<number>, callback: AsyncCallback<number>): void; 2186 2187 /** 2188 * Computes the geomagnetic inclination in radians from the inclination matrix. 2189 * @param { Array<number> } inclinationMatrix - Indicates the inclination matrix. 2190 * @returns { Promise<number> } Promise used to return the result. 2191 * @throws { BusinessError } 401 - Parameter error. 2192 * @throws { BusinessError } 14500101 - Service exception. 2193 * @syscap SystemCapability.Sensors.Sensor 2194 * @since 9 2195 */ 2196 function getInclination(inclinationMatrix: Array<number>): Promise<number>; 2197 2198 /** 2199 * Get the angle change between two rotation matrices 2200 * @param { Array<number> } currentRotationMatrix - Indicates the current rotation matrix. 2201 * @param { Array<number> } preRotationMatrix - Indicates the current rotation matrix. 2202 * @param { AsyncCallback<Array<number>> } callback - callback angle variation. 2203 * @syscap SystemCapability.Sensors.Sensor 2204 * @since 8 2205 * @deprecated since 9 2206 * @useinstead sensor#getAngleVariation 2207 */ 2208 function getAngleModify(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>, 2209 callback: AsyncCallback<Array<number>>): void; 2210 2211 /** 2212 * Get the angle change between two rotation matrices 2213 * @param { Array<number> } currentRotationMatrix - currentRotationMatrix Indicates the current rotation matrix. 2214 * @param { Array<number> } preRotationMatrix - preRotationMatrix Indicates the current rotation matrix. 2215 * @returns { Promise<Array<number>> } Returns the array of number(z, x and y) in which the angle variety. 2216 * @syscap SystemCapability.Sensors.Sensor 2217 * @since 8 2218 * @deprecated since 9 2219 * @useinstead sensor#getAngleVariation 2220 */ 2221 function getAngleModify(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise<Array<number>>; 2222 2223 /** 2224 * Get the angle variation between two rotation matrices. 2225 * @param { Array<number> } currentRotationMatrix - currentRotationMatrix Indicates the current rotation matrix. 2226 * @param { Array<number> } preRotationMatrix - preRotationMatrix Indicates the current rotation matrix. 2227 * @param { AsyncCallback<Array<number>> } callback - callback angle variation. 2228 * @throws { BusinessError } 401 - Parameter error. 2229 * @throws { BusinessError } 14500101 - Service exception. 2230 * @syscap SystemCapability.Sensors.Sensor 2231 * @since 9 2232 */ 2233 function getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>, 2234 callback: AsyncCallback<Array<number>>): void; 2235 2236 /** 2237 * Get the angle variation between two rotation matrices. 2238 * @param { Array<number> } currentRotationMatrix - Indicates the current rotation matrix. 2239 * @param { Array<number> } preRotationMatrix - preRotationMatrix Indicates the current rotation matrix. 2240 * @returns { Promise<Array<number>> } Promise used to return the result. 2241 * @throws { BusinessError } 401 - Parameter error. 2242 * @throws { BusinessError } 14500101 - Service exception. 2243 * @syscap SystemCapability.Sensors.Sensor 2244 * @since 9 2245 */ 2246 function getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise<Array<number>>; 2247 2248 /** 2249 * Convert rotation vector to rotation matrix. 2250 * @param { Array<number> } rotationVector - Indicates the rotation vector. 2251 * @param { AsyncCallback<Array<number>> } callback - callback rotation matrix. 2252 * @syscap SystemCapability.Sensors.Sensor 2253 * @since 8 2254 * @deprecated since 9 2255 * @useinstead sensor#getRotationMatrix 2256 */ 2257 function createRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void; 2258 2259 /** 2260 * Convert rotation vector to rotation matrix. 2261 * @param { Array<number> } rotationVector - rotationVector Indicates the rotation vector. 2262 * @returns { Promise<Array<number>> } Returns the rotation matrix. 2263 * @syscap SystemCapability.Sensors.Sensor 2264 * @since 8 2265 * @deprecated since 9 2266 * @useinstead sensor#getRotationMatrix 2267 */ 2268 function createRotationMatrix(rotationVector: Array<number>): Promise<Array<number>>; 2269 2270 /** 2271 * Convert rotation vector to rotation matrix. 2272 * @param { Array<number> } rotationVector - rotationVector Indicates the rotation vector. 2273 * @param { AsyncCallback<Array<number>> } callback - callback rotation matrix. 2274 * @throws { BusinessError } 401 - Parameter error. 2275 * @throws { BusinessError } 14500101 - Service exception. 2276 * @syscap SystemCapability.Sensors.Sensor 2277 * @since 9 2278 */ 2279 function getRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void; 2280 2281 /** 2282 * Convert rotation vector to rotation matrix. 2283 * @param { Array<number> } rotationVector - rotationVector Indicates the rotation vector. 2284 * @returns { Promise<Array<number>> } Promise used to return the result. 2285 * @throws { BusinessError } 401 - Parameter error. 2286 * @throws { BusinessError } 14500101 - Service exception. 2287 * @syscap SystemCapability.Sensors.Sensor 2288 * @since 9 2289 */ 2290 function getRotationMatrix(rotationVector: Array<number>): Promise<Array<number>>; 2291 2292 /** 2293 * Indicates the axis of the new coordinate system that coincides with the XY axis of the original coordinate system. 2294 * @typedef CoordinatesOptions 2295 * @syscap SystemCapability.Sensors.Sensor 2296 * @since 8 2297 */ 2298 interface CoordinatesOptions { 2299 /** Indicates the axis of the new coordinate system that coincides with the X axis of the original coordinate system. 2300 * @type { number } 2301 * @syscap SystemCapability.Sensors.Sensor 2302 * @since 8 2303 */ 2304 x: number; 2305 2306 /** Indicates the axis of the new coordinate system that coincides with the Z axis of the original coordinate system. 2307 * @type { number } 2308 * @syscap SystemCapability.Sensors.Sensor 2309 * @since 8 2310 */ 2311 y: number; 2312 } 2313 2314 /** 2315 * Rotate the provided rotation matrix so that it can be represented in a different way Coordinate System 2316 * @param { Array<number> } inRotationVector - Indicates the rotation matrix to be transformed. 2317 * @param { CoordinatesOptions } coordinates - Indicates coordinate system guidance, {@code CoordinatesOptions}. 2318 * @param { AsyncCallback<Array<number>> } callback - callback rotation matrix. 2319 * @syscap SystemCapability.Sensors.Sensor 2320 * @since 8 2321 * @deprecated since 9 2322 * @useinstead sensor#transformRotationMatrix 2323 */ 2324 function transformCoordinateSystem(inRotationVector: Array<number>, coordinates: CoordinatesOptions, 2325 callback: AsyncCallback<Array<number>>): void; 2326 2327 /** 2328 * Rotate the provided rotation matrix so that it can be represented in a different way Coordinate System 2329 * @param { Array<number> } inRotationVector - inRotationVector Indicates the rotation matrix to be transformed. 2330 * @param { CoordinatesOptions } coordinates - coordinates Indicates coordinate system guidance, {@code CoordinatesOptions}. 2331 * @returns { Promise<Array<number>> } Returns the transformed rotation matrix. 2332 * @syscap SystemCapability.Sensors.Sensor 2333 * @since 8 2334 * @deprecated since 9 2335 * @useinstead sensor#transformRotationMatrix 2336 */ 2337 function transformCoordinateSystem(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise<Array<number>>; 2338 2339 /** 2340 * Rotate the provided rotation matrix so that it can be represented in a different way coordinate System. 2341 * @param { Array<number> } inRotationVector - inRotationVector Indicates the rotation matrix to be transformed. 2342 * @param { CoordinatesOptions } coordinates - coordinates Indicates coordinate system guidance, {@code CoordinatesOptions}. 2343 * @param { AsyncCallback<Array<number>> } callback - callback rotation matrix. 2344 * @throws { BusinessError } 401 - Parameter error. 2345 * @throws { BusinessError } 14500101 - Service exception. 2346 * @syscap SystemCapability.Sensors.Sensor 2347 * @since 9 2348 */ 2349 function transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions, 2350 callback: AsyncCallback<Array<number>>): void; 2351 2352 /** 2353 * Rotate the provided rotation matrix so that it can be represented in a different way coordinate System. 2354 * @param { Array<number> } inRotationVector - inRotationVector Indicates the rotation matrix to be transformed. 2355 * @param { CoordinatesOptions } coordinates - coordinates Indicates coordinate system guidance, {@code CoordinatesOptions}. 2356 * @returns { Promise<Array<number>> } Promise used to return the result. 2357 * @throws { BusinessError } 401 - Parameter error. 2358 * @throws { BusinessError } 14500101 - Service exception. 2359 * @syscap SystemCapability.Sensors.Sensor 2360 * @since 9 2361 */ 2362 function transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise<Array<number>>; 2363 2364 /** 2365 * convert a rotation vector to a normalized quaternion. 2366 * @param { Array<number> } rotationVector - Indicates the rotation vector. 2367 * @param { AsyncCallback<Array<number>> } callback - callback a normalized quaternion. 2368 * @syscap SystemCapability.Sensors.Sensor 2369 * @since 8 2370 * @deprecated since 9 2371 * @useinstead sensor#getQuaternion 2372 */ 2373 function createQuaternion(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void; 2374 2375 /** 2376 * convert a rotation vector to a normalized quaternion. 2377 * @param { Array<number> } rotationVector - rotationVector Indicates the rotation vector. 2378 * @returns { Promise<Array<number>> } Returns the normalized quaternion. 2379 * @syscap SystemCapability.Sensors.Sensor 2380 * @since 8 2381 * @deprecated since 9 2382 * @useinstead sensor#getQuaternion 2383 */ 2384 function createQuaternion(rotationVector: Array<number>): Promise<Array<number>>; 2385 2386 /** 2387 * convert a rotation vector to a normalized quaternion. 2388 * @param { Array<number> } rotationVector - rotationVector Indicates the rotation vector. 2389 * @param { AsyncCallback<Array<number>> } callback - callback a normalized quaternion. 2390 * @throws { BusinessError } 401 - Parameter error. 2391 * @throws { BusinessError } 14500101 - Service exception. 2392 * @syscap SystemCapability.Sensors.Sensor 2393 * @since 9 2394 */ 2395 function getQuaternion(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void; 2396 2397 /** 2398 * convert a rotation vector to a normalized quaternion. 2399 * @param { Array<number> } rotationVector - rotationVector Indicates the rotation vector. 2400 * @returns { Promise<Array<number>> } Promise used to return the result. 2401 * @throws { BusinessError } 401 - Parameter error. 2402 * @throws { BusinessError } 14500101 - Service exception. 2403 * @syscap SystemCapability.Sensors.Sensor 2404 * @since 9 2405 */ 2406 function getQuaternion(rotationVector: Array<number>): Promise<Array<number>>; 2407 2408 /** 2409 * Computes the device's orientation based on the rotation matrix. 2410 * @param { Array<number> } rotationMatrix - Indicates the rotation matrix. 2411 * @param { AsyncCallback<Array<number>> } callback - callback the angle of rotation around the z, x, y axis. 2412 * @syscap SystemCapability.Sensors.Sensor 2413 * @since 8 2414 * @deprecated since 9 2415 * @useinstead sensor#getOrientation 2416 */ 2417 function getDirection(rotationMatrix: Array<number>, callback: AsyncCallback<Array<number>>): void; 2418 2419 /** 2420 * Computes the device's orientation based on the rotation matrix. 2421 * @param { Array<number> } rotationMatrix - rotationMatrix Indicates the rotation matrix. 2422 * @returns { Promise<Array<number>> } Returns the array is the angle of rotation around the z, x, y axis. 2423 * @syscap SystemCapability.Sensors.Sensor 2424 * @since 8 2425 * @deprecated since 9 2426 * @useinstead sensor#getOrientation 2427 */ 2428 function getDirection(rotationMatrix: Array<number>): Promise<Array<number>>; 2429 2430 /** 2431 * Computes the device's orientation based on the rotation matrix. 2432 * @param { Array<number> } rotationMatrix - rotationMatrix Indicates the rotation matrix. 2433 * @param { AsyncCallback<Array<number>> } callback - callback the angle of rotation around the z, x, y axis. 2434 * @throws { BusinessError } 401 - Parameter error. 2435 * @throws { BusinessError } 14500101 - Service exception. 2436 * @syscap SystemCapability.Sensors.Sensor 2437 * @since 9 2438 */ 2439 function getOrientation(rotationMatrix: Array<number>, callback: AsyncCallback<Array<number>>): void; 2440 2441 /** 2442 * Computes the device's orientation based on the rotation matrix. 2443 * @param { Array<number> } rotationMatrix - rotationMatrix Indicates the rotation matrix. 2444 * @returns { Promise<Array<number>> } Promise used to return the result. 2445 * @throws { BusinessError } 401 - Parameter error. 2446 * @throws { BusinessError } 14500101 - Service exception. 2447 * @syscap SystemCapability.Sensors.Sensor 2448 * @since 9 2449 */ 2450 function getOrientation(rotationMatrix: Array<number>): Promise<Array<number>>; 2451 2452 /** 2453 * Indicates the response of rotation matrix. 2454 * @typedef RotationMatrixResponse 2455 * @syscap SystemCapability.Sensors.Sensor 2456 * @since 8 2457 */ 2458 interface RotationMatrixResponse { 2459 /** 2460 * rotation matrix. 2461 * @type { Array<number> } 2462 * @syscap SystemCapability.Sensors.Sensor 2463 * @since 8 2464 */ 2465 rotation: Array<number>; 2466 2467 /** 2468 * inclination matrix. 2469 * @type { Array<number> } 2470 * @syscap SystemCapability.Sensors.Sensor 2471 * @since 8 2472 */ 2473 inclination: Array<number> 2474 } 2475 2476 /** 2477 * Calculate rotation matrix based on gravity vector and geomagnetic vector. 2478 * @param { Array<number> } gravity - Indicates the gravity vector. 2479 * @param { Array<number> } geomagnetic - Indicates the geomagnetic vector. 2480 * @param { AsyncCallback<RotationMatrixResponse> } callback - callback rotation matrix and inclination matrix. 2481 * @syscap SystemCapability.Sensors.Sensor 2482 * @since 8 2483 * @deprecated since 9 2484 * @useinstead sensor#getRotationMatrix 2485 */ 2486 function createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>, callback: AsyncCallback<RotationMatrixResponse>): void; 2487 2488 /** 2489 * Calculate rotation matrix based on gravity vector and geomagnetic vector. 2490 * @param { Array<number> } gravity - gravity Indicates the gravity vector. 2491 * @param { Array<number> } geomagnetic - geomagnetic Indicates the geomagnetic vector. 2492 * @returns { Promise<RotationMatrixResponse> } Returns the rotation matrix, {@code RotationMatrixResponse}. 2493 * @syscap SystemCapability.Sensors.Sensor 2494 * @since 8 2495 * @deprecated since 9 2496 * @useinstead sensor#getRotationMatrix 2497 */ 2498 function createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>,): Promise<RotationMatrixResponse>; 2499 2500 /** 2501 * Calculate rotation matrix based on gravity vector and geomagnetic vector. 2502 * @param { Array<number> } gravity - gravity Indicates the gravity vector. 2503 * @param { Array<number> } geomagnetic - geomagnetic Indicates the geomagnetic vector. 2504 * @param { AsyncCallback<RotationMatrixResponse> } callback - callback rotation matrix and inclination matrix. 2505 * @throws { BusinessError } 401 - Parameter error. 2506 * @throws { BusinessError } 14500101 - Service exception. 2507 * @syscap SystemCapability.Sensors.Sensor 2508 * @since 9 2509 */ 2510 function getRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>, callback: AsyncCallback<RotationMatrixResponse>): void; 2511 2512 /** 2513 * Calculate rotation matrix based on gravity vector and geomagnetic vector. 2514 * @param { Array<number> } gravity - gravity Indicates the gravity vector. 2515 * @param { Array<number> } geomagnetic - geomagnetic Indicates the geomagnetic vector. 2516 * @returns { Promise<RotationMatrixResponse> } Promise used to return the result. 2517 * @throws { BusinessError } 401 - Parameter error. 2518 * @throws { BusinessError } 14500101 - Service exception. 2519 * @syscap SystemCapability.Sensors.Sensor 2520 * @since 9 2521 */ 2522 function getRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>): Promise<RotationMatrixResponse>; 2523 2524 /** 2525 * Subscribe to the sensor's optional parameters. 2526 * @typedef Options 2527 * @syscap SystemCapability.Sensors.Sensor 2528 * @since 8 2529 */ 2530 interface Options { 2531 /** 2532 * Sensor event reporting event interval 2533 * @type { ?number } 2534 * @syscap SystemCapability.Sensors.Sensor 2535 * @since 8 2536 */ 2537 interval?: number; 2538 } 2539 2540 /** 2541 * The type of number. 2542 * @enum { number } 2543 * @syscap SystemCapability.Sensors.Sensor 2544 * @since 8 2545 * @deprecated since 9 2546 * @useinstead sensor.SensorId 2547 */ 2548 enum SensorType { 2549 /** 2550 * Acceleration sensor. 2551 * @syscap SystemCapability.Sensors.Sensor 2552 * @since 8 2553 * @deprecated since 9 2554 */ 2555 SENSOR_TYPE_ID_ACCELEROMETER = 1, 2556 2557 /** 2558 * Gyroscope sensor 2559 * @syscap SystemCapability.Sensors.Sensor 2560 * @since 8 2561 * @deprecated since 9 2562 */ 2563 SENSOR_TYPE_ID_GYROSCOPE = 2, 2564 2565 /** 2566 * Ambient light sensor. 2567 * @syscap SystemCapability.Sensors.Sensor 2568 * @since 8 2569 * @deprecated since 9 2570 */ 2571 SENSOR_TYPE_ID_AMBIENT_LIGHT = 5, 2572 2573 /** 2574 * Magnetic field sensor. 2575 * @syscap SystemCapability.Sensors.Sensor 2576 * @since 8 2577 * @deprecated since 9 2578 */ 2579 SENSOR_TYPE_ID_MAGNETIC_FIELD = 6, 2580 2581 /** 2582 * Barometric pressure sensor. 2583 * @syscap SystemCapability.Sensors.Sensor 2584 * @since 8 2585 * @deprecated since 9 2586 */ 2587 SENSOR_TYPE_ID_BAROMETER = 8, 2588 2589 /** 2590 * Hall effect sensor. 2591 * @syscap SystemCapability.Sensors.Sensor 2592 * @since 8 2593 * @deprecated since 9 2594 */ 2595 SENSOR_TYPE_ID_HALL = 10, 2596 2597 /** 2598 * Proximity sensor. 2599 * @syscap SystemCapability.Sensors.Sensor 2600 * @since 8 2601 * @deprecated since 9 2602 */ 2603 SENSOR_TYPE_ID_PROXIMITY = 12, 2604 2605 /** 2606 * Humidity sensor. 2607 * @syscap SystemCapability.Sensors.Sensor 2608 * @since 8 2609 * @deprecated since 9 2610 */ 2611 SENSOR_TYPE_ID_HUMIDITY = 13, 2612 2613 /** 2614 * Orientation sensor. 2615 * @syscap SystemCapability.Sensors.Sensor 2616 * @since 8 2617 * @deprecated since 9 2618 */ 2619 SENSOR_TYPE_ID_ORIENTATION = 256, 2620 2621 /** 2622 * Gravity sensor. 2623 * @syscap SystemCapability.Sensors.Sensor 2624 * @since 8 2625 * @deprecated since 9 2626 */ 2627 SENSOR_TYPE_ID_GRAVITY = 257, 2628 2629 /** 2630 * Linear acceleration sensor. 2631 * @syscap SystemCapability.Sensors.Sensor 2632 * @since 8 2633 * @deprecated since 9 2634 */ 2635 SENSOR_TYPE_ID_LINEAR_ACCELERATION = 258, 2636 2637 /** 2638 * Rotation vector sensor. 2639 * @syscap SystemCapability.Sensors.Sensor 2640 * @since 8 2641 * @deprecated since 9 2642 */ 2643 SENSOR_TYPE_ID_ROTATION_VECTOR = 259, 2644 2645 /** 2646 * Ambient temperature sensor. 2647 * @syscap SystemCapability.Sensors.Sensor 2648 * @since 8 2649 * @deprecated since 9 2650 */ 2651 SENSOR_TYPE_ID_AMBIENT_TEMPERATURE = 260, 2652 2653 /** 2654 * Uncalibrated magnetic field sensor. 2655 * @syscap SystemCapability.Sensors.Sensor 2656 * @since 8 2657 * @deprecated since 9 2658 */ 2659 SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED = 261, 2660 2661 /** 2662 * Uncalibrated gyroscope sensor. 2663 * @syscap SystemCapability.Sensors.Sensor 2664 * @since 8 2665 * @deprecated since 9 2666 */ 2667 SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED = 263, 2668 2669 /** 2670 * Significant motion sensor. 2671 * @syscap SystemCapability.Sensors.Sensor 2672 * @since 8 2673 * @deprecated since 9 2674 */ 2675 SENSOR_TYPE_ID_SIGNIFICANT_MOTION = 264, 2676 2677 /** 2678 * Pedometer detection sensor. 2679 * @syscap SystemCapability.Sensors.Sensor 2680 * @since 8 2681 * @deprecated since 9 2682 */ 2683 SENSOR_TYPE_ID_PEDOMETER_DETECTION = 265, 2684 2685 /** 2686 * Pedometer sensor. 2687 * @syscap SystemCapability.Sensors.Sensor 2688 * @since 8 2689 * @deprecated since 9 2690 */ 2691 SENSOR_TYPE_ID_PEDOMETER = 266, 2692 2693 /** 2694 * Heart rate sensor. 2695 * @syscap SystemCapability.Sensors.Sensor 2696 * @since 8 2697 * @deprecated since 9 2698 */ 2699 SENSOR_TYPE_ID_HEART_RATE = 278, 2700 2701 /** 2702 * Wear detection sensor. 2703 * @syscap SystemCapability.Sensors.Sensor 2704 * @since 8 2705 * @deprecated since 9 2706 */ 2707 SENSOR_TYPE_ID_WEAR_DETECTION = 280, 2708 2709 /** 2710 * Uncalibrated acceleration sensor. 2711 * @syscap SystemCapability.Sensors.Sensor 2712 * @since 8 2713 * @deprecated since 9 2714 */ 2715 SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED = 281 2716 } 2717 2718 /** 2719 * The basic data structure of the sensor event. 2720 * @typedef Response 2721 * @syscap SystemCapability.Sensors.Sensor 2722 * @since 8 2723 */ 2724 interface Response { 2725 /** 2726 * The timestamp of the reported sensor data 2727 * @type { number } 2728 * @syscap SystemCapability.Sensors.Sensor 2729 * @since 8 2730 */ 2731 timestamp: number; 2732 } 2733 2734 /** 2735 * Acceleration sensor event data. 2736 * @typedef AccelerometerResponse 2737 * @syscap SystemCapability.Sensors.Sensor 2738 * @since 8 2739 */ 2740 interface AccelerometerResponse extends Response { 2741 /** 2742 * Acceleration x-axis component. 2743 * @type { number } 2744 * @syscap SystemCapability.Sensors.Sensor 2745 * @since 8 2746 */ 2747 x: number; 2748 2749 /** 2750 * Acceleration y-axis component. 2751 * @type { number } 2752 * @syscap SystemCapability.Sensors.Sensor 2753 * @since 8 2754 */ 2755 y: number; 2756 2757 /** 2758 * Acceleration z-axis component 2759 * @type { number } 2760 * @syscap SystemCapability.Sensors.Sensor 2761 * @since 8 2762 */ 2763 z: number; 2764 } 2765 2766 /** 2767 * Linear acceleration sensor event data. 2768 * @typedef LinearAccelerometerResponse 2769 * @syscap SystemCapability.Sensors.Sensor 2770 * @since 8 2771 */ 2772 interface LinearAccelerometerResponse extends Response { 2773 /** 2774 * Linear acceleration x-axis component 2775 * @type { number } 2776 * @syscap SystemCapability.Sensors.Sensor 2777 * @since 8 2778 */ 2779 x: number; 2780 2781 /** 2782 * Linear acceleration y-axis component 2783 * @type { number } 2784 * @syscap SystemCapability.Sensors.Sensor 2785 * @since 8 2786 */ 2787 y: number; 2788 2789 /** 2790 * Linear acceleration z-axis component 2791 * @type { number } 2792 * @syscap SystemCapability.Sensors.Sensor 2793 * @since 8 2794 */ 2795 z: number; 2796 } 2797 2798 /** 2799 * Acceleration uncalibrated sensor event data. 2800 * @typedef AccelerometerUncalibratedResponse 2801 * @syscap SystemCapability.Sensors.Sensor 2802 * @since 8 2803 */ 2804 interface AccelerometerUncalibratedResponse extends Response { 2805 /** 2806 * Acceleration uncalibrated x-axis component. 2807 * @type { number } 2808 * @syscap SystemCapability.Sensors.Sensor 2809 * @since 8 2810 */ 2811 x: number; 2812 2813 /** 2814 * Acceleration uncalibrated y-axis component. 2815 * @type { number } 2816 * @syscap SystemCapability.Sensors.Sensor 2817 * @since 8 2818 */ 2819 y: number; 2820 2821 /** 2822 * Acceleration uncalibrated z-axis component. 2823 * @type { number } 2824 * @syscap SystemCapability.Sensors.Sensor 2825 * @since 8 2826 */ 2827 z: number; 2828 2829 /** 2830 * Acceleration uncalibrated x-axis offset. 2831 * 2832 * @type { number } 2833 * @syscap SystemCapability.Sensors.Sensor 2834 * @since 8 2835 */ 2836 biasX: number; 2837 2838 /** 2839 * Acceleration uncalibrated y-axis offset 2840 * 2841 * @type { number } 2842 * @syscap SystemCapability.Sensors.Sensor 2843 * @since 8 2844 */ 2845 biasY: number; 2846 2847 /** 2848 * Acceleration uncalibrated z-axis offset 2849 * 2850 * @type { number } 2851 * @syscap SystemCapability.Sensors.Sensor 2852 * @since 8 2853 */ 2854 biasZ: number; 2855 } 2856 2857 /** 2858 * Gravity sensor event data. 2859 * @typedef GravityResponse 2860 * @syscap SystemCapability.Sensors.Sensor 2861 * @since 8 2862 */ 2863 interface GravityResponse extends Response { 2864 /** 2865 * Gravity x-axis component. 2866 * @type { number } 2867 * @syscap SystemCapability.Sensors.Sensor 2868 * @since 8 2869 */ 2870 x: number; 2871 2872 /** 2873 * Gravity y-axis component. 2874 * @type { number } 2875 * @syscap SystemCapability.Sensors.Sensor 2876 * @since 8 2877 */ 2878 y: number; 2879 2880 /** 2881 * Gravity z-axis component. 2882 * @type { number } 2883 * @syscap SystemCapability.Sensors.Sensor 2884 * @since 8 2885 */ 2886 z: number; 2887 } 2888 2889 /** 2890 * Orientation sensor event data. 2891 * @typedef OrientationResponse 2892 * @syscap SystemCapability.Sensors.Sensor 2893 * @since 8 2894 */ 2895 interface OrientationResponse extends Response { 2896 /** 2897 * The device rotates at an angle around the Z axis. 2898 * @type { number } 2899 * @syscap SystemCapability.Sensors.Sensor 2900 * @since 8 2901 */ 2902 alpha: number; 2903 2904 /** 2905 * The device rotates at an angle around the X axis. 2906 * @type { number } 2907 * @syscap SystemCapability.Sensors.Sensor 2908 * @since 8 2909 */ 2910 beta: number; 2911 2912 /** 2913 * The device rotates at an angle around the Y axis. 2914 * @type { number } 2915 * @syscap SystemCapability.Sensors.Sensor 2916 * @since 8 2917 */ 2918 gamma: number; 2919 } 2920 2921 /** 2922 * Rotation vector sensor event data. 2923 * @typedef RotationVectorResponse 2924 * @syscap SystemCapability.Sensors.Sensor 2925 * @since 8 2926 */ 2927 interface RotationVectorResponse extends Response { 2928 /** 2929 * Rotation vector x-axis component. 2930 * @type { number } 2931 * @syscap SystemCapability.Sensors.Sensor 2932 * @since 8 2933 */ 2934 x: number; 2935 2936 /** 2937 * Rotation vector y-axis component. 2938 * @type { number } 2939 * @syscap SystemCapability.Sensors.Sensor 2940 * @since 8 2941 */ 2942 y: number; 2943 2944 /** 2945 * Rotation vector z-axis component. 2946 * @type { number } 2947 * @syscap SystemCapability.Sensors.Sensor 2948 * @since 8 2949 */ 2950 z: number; 2951 2952 /** 2953 * Scalar quantity. 2954 * @type { number } 2955 * @syscap SystemCapability.Sensors.Sensor 2956 * @since 8 2957 */ 2958 w: number; 2959 } 2960 2961 /** 2962 * Gyroscope sensor event data. 2963 * @typedef GyroscopeResponse 2964 * @syscap SystemCapability.Sensors.Sensor 2965 * @since 8 2966 */ 2967 interface GyroscopeResponse extends Response { 2968 /** 2969 * Gyroscope x-axis component. 2970 * @type { number } 2971 * @syscap SystemCapability.Sensors.Sensor 2972 * @since 8 2973 */ 2974 x: number; 2975 2976 /** 2977 * Gyroscope y-axis component. 2978 * @type { number } 2979 * @syscap SystemCapability.Sensors.Sensor 2980 * @since 8 2981 */ 2982 y: number; 2983 2984 /** 2985 * Gyroscope z-axis component. 2986 * @type { number } 2987 * @syscap SystemCapability.Sensors.Sensor 2988 * @since 8 2989 */ 2990 z: number; 2991 } 2992 2993 /** 2994 * Gyroscope uncalibrated sensor event data. 2995 * @typedef GyroscopeUncalibratedResponse 2996 * @syscap SystemCapability.Sensors.Sensor 2997 * @since 8 2998 */ 2999 interface GyroscopeUncalibratedResponse extends Response { 3000 /** 3001 * Gyroscope uncalibrated x-axis component. 3002 * @type { number } 3003 * @syscap SystemCapability.Sensors.Sensor 3004 * @since 8 3005 */ 3006 x: number; 3007 3008 /** 3009 * Gyroscope uncalibrated y-axis component. 3010 * @type { number } 3011 * @syscap SystemCapability.Sensors.Sensor 3012 * @since 8 3013 */ 3014 y: number; 3015 3016 /** 3017 * Gyroscope uncalibrated z-axis component. 3018 * @type { number } 3019 * @syscap SystemCapability.Sensors.Sensor 3020 * @since 8 3021 */ 3022 z: number; 3023 3024 /** 3025 * Gyroscope uncalibrated x-axis offset. 3026 * @type { number } 3027 * @syscap SystemCapability.Sensors.Sensor 3028 * @since 8 3029 */ 3030 biasX: number; 3031 3032 /** 3033 * Gyroscope uncalibrated y-axis offset. 3034 * @type { number } 3035 * @syscap SystemCapability.Sensors.Sensor 3036 * @since 8 3037 */ 3038 biasY: number; 3039 3040 /** 3041 * Gyroscope uncalibrated z-axis offset. 3042 * @type { number } 3043 * @syscap SystemCapability.Sensors.Sensor 3044 * @since 8 3045 */ 3046 biasZ: number; 3047 } 3048 3049 /** 3050 * Significant motion sensor event data. 3051 * @typedef SignificantMotionResponse 3052 * @syscap SystemCapability.Sensors.Sensor 3053 * @since 8 3054 */ 3055 interface SignificantMotionResponse extends Response { 3056 /** 3057 * The degree of significant motion. 3058 * @type { number } 3059 * @syscap SystemCapability.Sensors.Sensor 3060 * @since 8 3061 */ 3062 scalar: number; 3063 } 3064 3065 /** 3066 * Proximity sensor event data. 3067 * @typedef ProximityResponse 3068 * @syscap SystemCapability.Sensors.Sensor 3069 * @since 8 3070 */ 3071 interface ProximityResponse extends Response { 3072 /** 3073 * Indicates the degree of proximity, event 0 indicates proximity, and greater than 0 indicates distance. 3074 * @type { number } 3075 * @syscap SystemCapability.Sensors.Sensor 3076 * @since 8 3077 */ 3078 distance: number; 3079 } 3080 3081 /** 3082 * Light sensor event data. 3083 * @typedef LightResponse 3084 * @syscap SystemCapability.Sensors.Sensor 3085 * @since 8 3086 */ 3087 interface LightResponse extends Response { 3088 /** 3089 * Indicates light intensity, in lux. 3090 * @type { number } 3091 * @syscap SystemCapability.Sensors.Sensor 3092 * @since 8 3093 */ 3094 intensity: number; 3095 } 3096 3097 /** 3098 * Hall sensor event data. 3099 * @typedef HallResponse 3100 * @syscap SystemCapability.Sensors.Sensor 3101 * @since 8 3102 */ 3103 interface HallResponse extends Response { 3104 /** 3105 * Indicates hall status, 0 indicates open, and greater than 0 indicates suction. 3106 * @type { number } 3107 * @syscap SystemCapability.Sensors.Sensor 3108 * @since 8 3109 */ 3110 status: number; 3111 } 3112 3113 /** 3114 * Magnetic field sensor event data. 3115 * @typedef MagneticFieldResponse 3116 * @syscap SystemCapability.Sensors.Sensor 3117 * @since 8 3118 */ 3119 interface MagneticFieldResponse extends Response { 3120 /** 3121 * Magnetic field x-axis component. 3122 * @type { number } 3123 * @syscap SystemCapability.Sensors.Sensor 3124 * @since 8 3125 */ 3126 x: number; 3127 3128 /** 3129 * Magnetic field y-axis component. 3130 * @type { number } 3131 * @syscap SystemCapability.Sensors.Sensor 3132 * @since 8 3133 */ 3134 y: number; 3135 3136 /** 3137 * Magnetic field z-axis component. 3138 * @type { number } 3139 * @syscap SystemCapability.Sensors.Sensor 3140 * @since 8 3141 */ 3142 z: number; 3143 } 3144 3145 /** 3146 * Magnetic field uncalibrated sensor event data. 3147 * @typedef MagneticFieldUncalibratedResponse 3148 * @syscap SystemCapability.Sensors.Sensor 3149 * @since 8 3150 */ 3151 interface MagneticFieldUncalibratedResponse extends Response { 3152 /** 3153 * Magnetic field uncalibrated x-axis component. 3154 * @type { number } 3155 * @syscap SystemCapability.Sensors.Sensor 3156 * @since 8 3157 */ 3158 x: number; 3159 3160 /** 3161 * Magnetic field uncalibrated y-axis component. 3162 * @type { number } 3163 * @syscap SystemCapability.Sensors.Sensor 3164 * @since 8 3165 */ 3166 y: number; 3167 3168 /** 3169 * Magnetic field uncalibrated z-axis component. 3170 * @type { number } 3171 * @syscap SystemCapability.Sensors.Sensor 3172 * @since 8 3173 */ 3174 z: number; 3175 3176 /** 3177 * Magnetic field uncalibrated x-axis offset. 3178 * @type { number } 3179 * @syscap SystemCapability.Sensors.Sensor 3180 * @since 8 3181 */ 3182 biasX: number; 3183 3184 /** 3185 * Magnetic field uncalibrated y-axis offset. 3186 * @type { number } 3187 * @syscap SystemCapability.Sensors.Sensor 3188 * @since 8 3189 */ 3190 biasY: number; 3191 3192 /** 3193 * Magnetic field uncalibrated z-axis offset. 3194 * @type { number } 3195 * @syscap SystemCapability.Sensors.Sensor 3196 * @since 8 3197 */ 3198 biasZ: number; 3199 } 3200 3201 /** 3202 * Pedometer sensor event data. 3203 * @typedef PedometerResponse 3204 * @syscap SystemCapability.Sensors.Sensor 3205 * @since 8 3206 */ 3207 interface PedometerResponse extends Response { 3208 /** 3209 * Indicates the number of steps. 3210 * @type { number } 3211 * @syscap SystemCapability.Sensors.Sensor 3212 * @since 8 3213 */ 3214 steps: number; 3215 } 3216 3217 /** 3218 * Humidity sensor event data. 3219 * @typedef HumidityResponse 3220 * @syscap SystemCapability.Sensors.Sensor 3221 * @since 8 3222 */ 3223 interface HumidityResponse extends Response { 3224 /** 3225 * Indicates the number of humidity. 3226 * @type { number } 3227 * @syscap SystemCapability.Sensors.Sensor 3228 * @since 8 3229 */ 3230 humidity: number; 3231 } 3232 3233 /** 3234 * Pedometer detection sensor event data. 3235 * @typedef PedometerDetectionResponse 3236 * @syscap SystemCapability.Sensors.Sensor 3237 * @since 8 3238 */ 3239 interface PedometerDetectionResponse extends Response { 3240 /** 3241 * Indicates the pedometer detection status, 1 indicates that a walking action has occurred, and 0 indicates that no movement has occurred. 3242 * @type { number } 3243 * @syscap SystemCapability.Sensors.Sensor 3244 * @since 8 3245 */ 3246 scalar: number; 3247 } 3248 3249 /** 3250 * Ambient temperature sensor event data. 3251 * @typedef AmbientTemperatureResponse 3252 * @syscap SystemCapability.Sensors.Sensor 3253 * @since 8 3254 */ 3255 interface AmbientTemperatureResponse extends Response { 3256 /** 3257 * Indicates ambient temperature, in celsius. 3258 * @type { number } 3259 * @syscap SystemCapability.Sensors.Sensor 3260 * @since 8 3261 */ 3262 temperature: number; 3263 } 3264 3265 /** 3266 * Barometer sensor event data. 3267 * @typedef BarometerResponse 3268 * @syscap SystemCapability.Sensors.Sensor 3269 * @since 8 3270 */ 3271 interface BarometerResponse extends Response { 3272 /** 3273 * Indicates the number of barometer, in pascal. 3274 * @type { number } 3275 * @syscap SystemCapability.Sensors.Sensor 3276 * @since 8 3277 */ 3278 pressure: number; 3279 } 3280 3281 /** 3282 * Heart rate sensor event data. 3283 * @typedef HeartRateResponse 3284 * @syscap SystemCapability.Sensors.Sensor 3285 * @since 8 3286 */ 3287 interface HeartRateResponse extends Response { 3288 /** 3289 * Indicates the number of heart rate. 3290 * @type { number } 3291 * @syscap SystemCapability.Sensors.Sensor 3292 * @since 8 3293 */ 3294 heartRate: number; 3295 } 3296 3297 /** 3298 * Wear detection sensor event data. 3299 * @typedef WearDetectionResponse 3300 * @syscap SystemCapability.Sensors.Sensor 3301 * @since 8 3302 */ 3303 interface WearDetectionResponse extends Response { 3304 /** 3305 * Indicates the status of wear detection, 1 for wearing, 0 for wearing not. 3306 * @type { number } 3307 * @syscap SystemCapability.Sensors.Sensor 3308 * @since 8 3309 */ 3310 value: number; 3311 } 3312 3313 /** 3314 * Color sensor event data. 3315 * @syscap SystemCapability.Sensors.Sensor 3316 * @systemapi 3317 * @since 10 3318 */ 3319 interface ColorResponse extends Response { 3320 /** 3321 * Indicates the intensity of light, in lux. 3322 * @type { number } 3323 * @syscap SystemCapability.Sensors.Sensor 3324 * @since 10 3325 * @systemapi 3326 */ 3327 lightIntensity: number; 3328 /** 3329 * Indicates the color temperature, in kelvin. 3330 * @type { number } 3331 * @syscap SystemCapability.Sensors.Sensor 3332 * @since 10 3333 * @systemapi 3334 */ 3335 colorTemperature: number; 3336 } 3337 3338 /** 3339 * Sar sensor event data. 3340 * @syscap SystemCapability.Sensors.Sensor 3341 * @systemapi 3342 * @since 10 3343 */ 3344 interface SarResponse extends Response { 3345 /** 3346 * Indicates the specific absorption rate, in W/kg. 3347 * @type { number } 3348 * @syscap SystemCapability.Sensors.Sensor 3349 * @since 10 3350 * @systemapi 3351 */ 3352 absorptionRatio: number; 3353 } 3354} 3355 3356export default sensor;