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