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