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 * @interface AccelerometerResponse 18 * @permission ohos.permission.ACCELEROMETER 19 * @syscap SystemCapability.Sensors.Sensor.Lite 20 * @since 3 21 * @deprecated since 8 22 * @useinstead ohos.sensor/sensor#AccelerometerResponse 23 */ 24export interface AccelerometerResponse { 25 /** 26 * X-coordinate 27 * 28 * @permission ohos.permission.ACCELEROMETER 29 * @syscap SystemCapability.Sensors.Sensor.Lite 30 * @since 3 31 * @deprecated since 8 32 */ 33 x: number; 34 35 /** 36 * Y-coordinate 37 * 38 * @permission ohos.permission.ACCELEROMETER 39 * @syscap SystemCapability.Sensors.Sensor.Lite 40 * @since 3 41 * @deprecated since 8 42 */ 43 y: number; 44 45 /** 46 * Z-coordinate 47 * 48 * @permission ohos.permission.ACCELEROMETER 49 * @syscap SystemCapability.Sensors.Sensor.Lite 50 * @since 3 51 * @deprecated since 8 52 */ 53 z: number; 54} 55 56/** 57 * @interface subscribeAccelerometerOptions 58 * @permission ohos.permission.ACCELEROMETER 59 * @syscap SystemCapability.Sensors.Sensor.Lite 60 * @since 3 61 * @deprecated since 8 62 * @useinstead ohos.sensor/sensor.SensorId#ACCELEROMETER 63 */ 64export interface subscribeAccelerometerOptions { 65 /** 66 * Execution frequency of the callback function for listening to acceleration sensor data. 67 * Available values are as follows: 68 * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. 69 * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. 70 * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. 71 * The default value is normal. 72 * 73 * @permission ohos.permission.ACCELEROMETER 74 * @syscap SystemCapability.Sensors.Sensor.Lite 75 * @since 3 76 * @deprecated since 8 77 */ 78 interval: string; 79 80 /** 81 * Called when acceleration sensor data changes. 82 * 83 * @permission ohos.permission.ACCELEROMETER 84 * @syscap SystemCapability.Sensors.Sensor.Lite 85 * @since 3 86 * @deprecated since 8 87 */ 88 success: (data: AccelerometerResponse) => void; 89 90 /** 91 * Called when the listening fails. 92 * 93 * @permission ohos.permission.ACCELEROMETER 94 * @syscap SystemCapability.Sensors.Sensor.Lite 95 * @since 3 96 * @deprecated since 8 97 */ 98 fail?: (data: string, code: number) => void; 99} 100 101/** 102 * @interface CompassResponse 103 * @syscap SystemCapability.Sensors.Sensor.Lite 104 * @since 3 105 * @deprecated since 8 106 * @useinstead ohos.sensor/sensor#MagneticFieldResponse 107 */ 108export interface CompassResponse { 109 /** 110 * Direction of the device (in degrees). 111 * 112 * @syscap SystemCapability.Sensors.Sensor.Lite 113 * @since 3 114 * @deprecated since 8 115 */ 116 direction: number; 117} 118 119/** 120 * @interface SubscribeCompassOptions 121 * @syscap SystemCapability.Sensors.Sensor.Lite 122 * @since 3 123 * @deprecated since 8 124 * @useinstead ohos.sensor/sensor.SensorId#MAGNETIC_FIELD 125 */ 126export interface SubscribeCompassOptions { 127 /** 128 * Called when compass sensor data changes. 129 * 130 * @syscap SystemCapability.Sensors.Sensor.Lite 131 * @since 3 132 * @deprecated since 8 133 */ 134 success: (data: CompassResponse) => void; 135 136 /** 137 * Called when the listening fails. 138 * 139 * @syscap SystemCapability.Sensors.Sensor.Lite 140 * @since 3 141 * @deprecated since 8 142 */ 143 fail?: (data: string, code: number) => void; 144} 145 146/** 147 * @interface ProximityResponse 148 * @syscap SystemCapability.Sensors.Sensor.Lite 149 * @since 3 150 * @deprecated since 8 151 * @useinstead ohos.sensor/sensor#ProximityResponse 152 */ 153export interface ProximityResponse { 154 /** 155 * Distance between a visible object and the device screen 156 * 157 * @syscap SystemCapability.Sensors.Sensor.Lite 158 * @since 3 159 * @deprecated since 8 160 */ 161 distance: number; 162} 163 164/** 165 * @interface SubscribeProximityOptions 166 * @syscap SystemCapability.Sensors.Sensor.Lite 167 * @since 3 168 * @deprecated since 8 169 * @useinstead ohos.sensor/sensor.SensorId#PROXIMITY 170 */ 171export interface SubscribeProximityOptions { 172 /** 173 * Called when distance sensor data changes. 174 * * 175 * @syscap SystemCapability.Sensors.Sensor.Lite 176 * @since 3 177 * @deprecated since 8 178 */ 179 success: (data: ProximityResponse) => void; 180 181 /** 182 * Called when the listening fails. 183 * * 184 * @syscap SystemCapability.Sensors.Sensor.Lite 185 * @since 3 186 * @deprecated since 8 187 */ 188 fail?: (data: string, code: number) => void; 189} 190 191/** 192 * @interface LightResponse 193 * @syscap SystemCapability.Sensors.Sensor.Lite 194 * @since 3 195 * @deprecated since 8 196 * @useinstead ohos.sensor/sensor#LightResponse 197 */ 198export interface LightResponse { 199 /** 200 * Light intensity, in lux. 201 * 202 * @syscap SystemCapability.Sensors.Sensor.Lite 203 * @since 3 204 * @deprecated since 8 205 */ 206 intensity: number; 207} 208 209/** 210 * @interface SubscribeLightOptions 211 * @syscap SystemCapability.Sensors.Sensor.Lite 212 * @since 3 213 * @deprecated since 8 214 * @useinstead ohos.sensor/sensor.SensorId#AMBIENT_LIGHT 215 */ 216export interface SubscribeLightOptions { 217 /** 218 * Called when ambient light sensor data changes. 219 * 220 * @syscap SystemCapability.Sensors.Sensor.Lite 221 * @since 3 222 * @deprecated since 8 223 */ 224 success: (data: LightResponse) => void; 225 226 /** 227 * Called when the listening fails. 228 * 229 * @syscap SystemCapability.Sensors.Sensor.Lite 230 * @since 3 231 * @deprecated since 8 232 */ 233 fail?: (data: string, code: number) => void; 234} 235 236/** 237 * @interface StepCounterResponse 238 * @permission ohos.permission.ACTIVITY_MOTION 239 * @syscap SystemCapability.Sensors.Sensor.Lite 240 * @since 3 241 * @deprecated since 8 242 * @useinstead ohos.sensor/sensor#PedometerResponse 243 */ 244export interface StepCounterResponse { 245 /** 246 * Number of steps counted. 247 * Each time the device restarts, the value is recalculated from 0 in phone, tablet. 248 * 249 * @permission ohos.permission.ACTIVITY_MOTION 250 * @syscap SystemCapability.Sensors.Sensor.Lite 251 * @since 3 252 * @deprecated since 8 253 */ 254 steps: number; 255} 256 257/** 258 * @interface SubscribeStepCounterOptions 259 * @permission ohos.permission.ACTIVITY_MOTION 260 * @syscap SystemCapability.Sensors.Sensor.Lite 261 * @since 3 262 * @deprecated since 8 263 * @useinstead ohos.sensor/SensorId#PEDOMETER 264 */ 265export interface SubscribeStepCounterOptions { 266 /** 267 * Called when step counter sensor data changes. 268 * 269 * @permission ohos.permission.ACTIVITY_MOTION 270 * @syscap SystemCapability.Sensors.Sensor.Lite 271 * @since 3 272 * @deprecated since 8 273 */ 274 success: (data: StepCounterResponse) => void; 275 276 /** 277 * Called when the listening fails. 278 * 279 * @permission ohos.permission.ACTIVITY_MOTION 280 * @syscap SystemCapability.Sensors.Sensor.Lite 281 * @since 3 282 * @deprecated since 8 283 */ 284 fail?: (data: string, code: number) => void; 285} 286 287/** 288 * @interface BarometerResponse 289 * @syscap SystemCapability.Sensors.Sensor.Lite 290 * @since 3 291 * @deprecated since 8 292 * @useinstead ohos.sensor/sensor#BarometerResponse 293 */ 294export interface BarometerResponse { 295 /** 296 * Pressure, in pascal. 297 * 298 * @syscap SystemCapability.Sensors.Sensor.Lite 299 * @since 3 300 * @deprecated since 8 301 */ 302 pressure: number; 303} 304 305/** 306 * @interface SubscribeBarometerOptions 307 * @syscap SystemCapability.Sensors.Sensor.Lite 308 * @since 3 309 * @deprecated since 8 310 * @useinstead ohos.sensor/sensor.SensorId#BAROMETER 311 */ 312export interface SubscribeBarometerOptions { 313 /** 314 * Called when the barometer sensor data changes. 315 * 316 * @syscap SystemCapability.Sensors.Sensor.Lite 317 * @since 3 318 * @deprecated since 8 319 */ 320 success: (data: BarometerResponse) => void; 321 322 /** 323 * Called when the listening fails. 324 * 325 * @syscap SystemCapability.Sensors.Sensor.Lite 326 * @since 3 327 * @deprecated since 8 328 */ 329 fail?: (data: string, code: number) => void; 330} 331 332/** 333 * @interface HeartRateResponse 334 * @permission ohos.permission.READ_HEALTH_DATA 335 * @syscap SystemCapability.Sensors.Sensor.Lite 336 * @since 3 337 * @deprecated since 8 338 * @useinstead ohos.sensor/sensor#HeartRateResponse 339 */ 340export interface HeartRateResponse { 341 /** 342 * Heart rate. 343 * 255 indicates an invalid value in lite wearable. 344 * 345 * @permission ohos.permission.READ_HEALTH_DATA 346 * @syscap SystemCapability.Sensors.Sensor.Lite 347 * @since 3 348 * @deprecated since 8 349 */ 350 heartRate: number; 351} 352 353/** 354 * @interface SubscribeHeartRateOptions 355 * @permission ohos.permission.READ_HEALTH_DATA 356 * @syscap SystemCapability.Sensors.Sensor.Lite 357 * @since 3 358 * @deprecated since 8 359 * @useinstead ohos.sensor/sensor.SensorId#HEART_RATE 360 */ 361export interface SubscribeHeartRateOptions { 362 /** 363 * Called when the heart rate sensor data changes. 364 * 365 * @permission ohos.permission.READ_HEALTH_DATA 366 * @syscap SystemCapability.Sensors.Sensor.Lite 367 * @since 3 368 * @deprecated since 8 369 */ 370 success: (data: HeartRateResponse) => void; 371 372 /** 373 * Called when the listening fails 374 * 375 * @permission ohos.permission.READ_HEALTH_DATA 376 * @syscap SystemCapability.Sensors.Sensor.Lite 377 * @since 3 378 * @deprecated since 8 379 */ 380 fail?: (data: string, code: number) => void; 381} 382 383/** 384 * @interface OnBodyStateResponse 385 * @syscap SystemCapability.Sensors.Sensor.Lite 386 * @since 3 387 * @deprecated since 8 388 * @useinstead ohos.sensor/sensor#WearDetectionResponse 389 */ 390export interface OnBodyStateResponse { 391 /** 392 * Whether the sensor is worn. 393 * 394 * @syscap SystemCapability.Sensors.Sensor.Lite 395 * @since 3 396 * @deprecated since 8 397 */ 398 value: boolean; 399} 400 401/** 402 * @interface SubscribeOnBodyStateOptions 403 * @syscap SystemCapability.Sensors.Sensor.Lite 404 * @since 3 405 * @deprecated since 8 406 * @useinstead ohos.sensor/sensor.SensorId#WEAR_DETECTION 407 */ 408export interface SubscribeOnBodyStateOptions { 409 /** 410 * Called when the wearing status changes. 411 * 412 * @syscap SystemCapability.Sensors.Sensor.Lite 413 * @since 3 414 * @deprecated since 8 415 */ 416 success: (data: OnBodyStateResponse) => void; 417 418 /** 419 * Called when the listening fails. 420 * 421 * @syscap SystemCapability.Sensors.Sensor.Lite 422 * @since 3 423 * @deprecated since 8 424 */ 425 fail?: (data: string, code: number) => void; 426} 427 428/** 429 * @interface GetOnBodyStateOptions 430 * @syscap SystemCapability.Sensors.Sensor.Lite 431 * @since 3 432 * @deprecated since 8 433 * @useinstead ohos.sensor/sensor.SensorId#WEAR_DETECTION 434 */ 435export interface GetOnBodyStateOptions { 436 /** 437 * Called when the sensor wearing state is obtained 438 * 439 * @syscap SystemCapability.Sensors.Sensor.Lite 440 * @since 3 441 * @deprecated since 8 442 */ 443 success: (data: OnBodyStateResponse) => void; 444 445 /** 446 * Called when the sensor wearing state fails to be obtained 447 * 448 * @syscap SystemCapability.Sensors.Sensor.Lite 449 * @since 3 450 * @deprecated since 8 451 */ 452 fail?: (data: string, code: number) => void; 453 454 /** 455 * Called when the execution is completed 456 * 457 * @syscap SystemCapability.Sensors.Sensor.Lite 458 * @since 3 459 * @deprecated since 8 460 */ 461 complete?: () => void; 462} 463 464/** 465 * @interface DeviceOrientationResponse 466 * @syscap SystemCapability.Sensors.Sensor.Lite 467 * @since 6 468 * @deprecated since 8 469 * @useinstead ohos.sensor/sensor#OrientationResponse 470 */ 471export interface DeviceOrientationResponse { 472 /** 473 * alpha 474 * 475 * @syscap SystemCapability.Sensors.Sensor.Lite 476 * @since 6 477 * @deprecated since 8 478 */ 479 alpha: number; 480 481 /** 482 * beta 483 * 484 * @syscap SystemCapability.Sensors.Sensor.Lite 485 * @since 6 486 * @deprecated since 8 487 */ 488 beta: number; 489 490 /** 491 * gamma 492 * 493 * @syscap SystemCapability.Sensors.Sensor.Lite 494 * @since 6 495 * @deprecated since 8 496 */ 497 gamma: number; 498} 499 500/** 501 * @interface SubscribeDeviceOrientationOptions 502 * @syscap SystemCapability.Sensors.Sensor.Lite 503 * @since 6 504 * @deprecated since 8 505 * @useinstead ohos.sensor/sensor.SensorId#ORIENTATION 506 */ 507export interface SubscribeDeviceOrientationOptions { 508 /** 509 * Execution frequency of the callback function for listening to device orientation sensor data. 510 * Available values are as follows: 511 * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. 512 * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. 513 * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. 514 * The default value is normal. 515 * 516 * @syscap SystemCapability.Sensors.Sensor.Lite 517 * @since 6 518 * @deprecated since 8 519 */ 520 interval: string; 521 522 /** 523 * Called when device orientation sensor data changes. 524 * 525 * @syscap SystemCapability.Sensors.Sensor.Lite 526 * @since 6 527 * @deprecated since 8 528 */ 529 success: (data: DeviceOrientationResponse) => void; 530 531 /** 532 * Called when the listening fails. 533 * 534 * @syscap SystemCapability.Sensors.Sensor.Lite 535 * @since 6 536 * @deprecated since 8 537 */ 538 fail?: (data: string, code: number) => void; 539} 540 541/** 542 * @interface GyroscopeResponse 543 * @permission ohos.permission.GYROSCOPE 544 * @syscap SystemCapability.Sensors.Sensor.Lite 545 * @since 6 546 * @deprecated since 8 547 * @useinstead ohos.sensor/sensor#GyroscopeResponse 548 */ 549export interface GyroscopeResponse { 550 /** 551 * X-coordinate 552 * 553 * @permission ohos.permission.GYROSCOPE 554 * @syscap SystemCapability.Sensors.Sensor.Lite 555 * @since 6 556 * @deprecated since 8 557 */ 558 x: number; 559 560 /** 561 * Y-coordinate 562 * 563 * @permission ohos.permission.GYROSCOPE 564 * @syscap SystemCapability.Sensors.Sensor.Lite 565 * @since 6 566 * @deprecated since 8 567 */ 568 y: number; 569 570 /** 571 * Z-coordinate 572 * 573 * @permission ohos.permission.GYROSCOPE 574 * @syscap SystemCapability.Sensors.Sensor.Lite 575 * @since 6 576 * @deprecated since 8 577 */ 578 z: number; 579} 580 581/** 582 * @interface SubscribeGyroscopeOptions 583 * @permission ohos.permission.GYROSCOPE 584 * @syscap SystemCapability.Sensors.Sensor.Lite 585 * @since 6 586 * @deprecated since 8 587 * @useinstead ohos.sensor/sensor.SensorId#GYROSCOPE 588 */ 589export interface SubscribeGyroscopeOptions { 590 /** 591 * Execution frequency of the callback function for listening to gyroscope sensor data. 592 * Available values are as follows: 593 * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. 594 * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. 595 * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. 596 * The default value is normal. 597 * 598 * @permission ohos.permission.GYROSCOPE 599 * @syscap SystemCapability.Sensors.Sensor.Lite 600 * @since 6 601 * @deprecated since 8 602 */ 603 interval: string; 604 605 /** 606 * Called when gyroscope sensor data changes. 607 * 608 * @permission ohos.permission.GYROSCOPE 609 * @syscap SystemCapability.Sensors.Sensor.Lite 610 * @since 6 611 * @deprecated since 8 612 */ 613 success: (data: GyroscopeResponse) => void; 614 615 /** 616 * Called when the listening fails. 617 * 618 * @permission ohos.permission.GYROSCOPE 619 * @syscap SystemCapability.Sensors.Sensor.Lite 620 * @since 6 621 * @deprecated since 8 622 */ 623 fail?: (data: string, code: number) => void; 624} 625 626/** 627 * @syscap SystemCapability.Sensors.Sensor.Lite 628 * @since 6 629 * @deprecated since 8 630 * @useinstead ohos.sensor/sensor 631 */ 632export default class Sensor { 633 /** 634 * Listens to acceleration sensor data changes. 635 * If this API is called multiple times, the last call takes effect. 636 * 637 * @permission ohos.permission.ACCELEROMETER 638 * @param { subscribeAccelerometerOptions } options - options Options. 639 * @syscap SystemCapability.Sensors.Sensor.Lite 640 * @since 3 641 * @deprecated since 8 642 * @useinstead ohos.sensor/sensor.SensorId#ACCELEROMETER 643 */ 644 static subscribeAccelerometer(options: subscribeAccelerometerOptions): void; 645 646 /** 647 * Cancels listening to acceleration sensor data. 648 * 649 * @permission ohos.permission.ACCELEROMETER 650 * @syscap SystemCapability.Sensors.Sensor.Lite 651 * @since 3 652 * @deprecated since 8 653 * @useinstead ohos.sensor/sensor.SensorId#ACCELEROMETER 654 */ 655 static unsubscribeAccelerometer(): void; 656 657 /** 658 * Listens to compass sensor data changes. 659 * If this API is called multiple times, the last call takes effect. 660 * 661 * @param { SubscribeCompassOptions } options - Options. 662 * @syscap SystemCapability.Sensors.Sensor.Lite 663 * @since 3 664 * @deprecated since 8 665 * @useinstead ohos.sensor/sensor.SensorId#MAGNETIC_FIELD 666 */ 667 static subscribeCompass(options: SubscribeCompassOptions): void; 668 669 /** 670 * Cancels listening to compass sensor data. 671 * 672 * @syscap SystemCapability.Sensors.Sensor.Lite 673 * @since 3 674 * @deprecated since 8 675 * @useinstead ohos.sensor/sensor.SensorId#MAGNETIC_FIELD 676 */ 677 static unsubscribeCompass(): void; 678 679 /** 680 * Listens to distance sensor data changes. 681 * If this API is called multiple times, the last call takes effect. 682 * 683 * @param { SubscribeProximityOptions } options - options Options. 684 * @syscap SystemCapability.Sensors.Sensor.Lite 685 * @since 3 686 * @deprecated since 8 687 * @useinstead ohos.sensor/sensor.SensorId#PROXIMITY 688 */ 689 static subscribeProximity(options: SubscribeProximityOptions): void; 690 691 /** 692 * Cancels listening to distance sensor data. 693 * 694 * @syscap SystemCapability.Sensors.Sensor.Lite 695 * @since 3 696 * @deprecated since 8 697 * @useinstead ohos.sensor/sensor.SensorId#PROXIMITY 698 */ 699 static unsubscribeProximity(): void; 700 701 /** 702 * Listens to ambient light sensor data changes. 703 * If this API is called multiple times, the last call takes effect. 704 * 705 * @param { SubscribeLightOptions } options - options Options. 706 * @syscap SystemCapability.Sensors.Sensor.Lite 707 * @since 3 708 * @deprecated since 8 709 * @useinstead ohos.sensor/sensor.SensorId#AMBIENT_LIGHT 710 */ 711 static subscribeLight(options: SubscribeLightOptions): void; 712 713 /** 714 * Cancels listening to ambient light sensor data. 715 * 716 * @syscap SystemCapability.Sensors.Sensor.Lite 717 * @since 3 718 * @deprecated since 8 719 * @useinstead ohos.sensor/sensor.SensorId#AMBIENT_LIGHT 720 */ 721 static unsubscribeLight(): void; 722 723 /** 724 * Listens to step counter sensor data changes. 725 * If this API is called multiple times, the last call takes effect. 726 * 727 * @permission ohos.permission.ACTIVITY_MOTION 728 * @param { SubscribeStepCounterOptions } options - options Options. 729 * @syscap SystemCapability.Sensors.Sensor.Lite 730 * @since 3 731 * @deprecated since 8 732 * @useinstead ohos.sensor/sensor.SensorId#PEDOMETER 733 */ 734 static subscribeStepCounter(options: SubscribeStepCounterOptions): void; 735 736 /** 737 * Cancels listening to step counter sensor data. 738 * 739 * @permission ohos.permission.ACTIVITY_MOTION 740 * @syscap SystemCapability.Sensors.Sensor.Lite 741 * @since 3 742 * @deprecated since 8 743 * @useinstead ohos.sensor/sensor.SensorId#PEDOMETER 744 */ 745 static unsubscribeStepCounter(): void; 746 747 /** 748 * Listens to barometer sensor data changes. 749 * If this API is called multiple times, the last call takes effect. 750 * 751 * @param { SubscribeBarometerOptions } options - options Options. 752 * @syscap SystemCapability.Sensors.Sensor.Lite 753 * @since 3 754 * @deprecated since 8 755 * @useinstead ohos.sensor/sensor.SensorId#BAROMETER 756 */ 757 static subscribeBarometer(options: SubscribeBarometerOptions): void; 758 759 /** 760 * Cancels listening to barometer sensor data. 761 * 762 * @syscap SystemCapability.Sensors.Sensor.Lite 763 * @since 3 764 * @deprecated since 8 765 * @useinstead ohos.sensor/sensor.SensorId#BAROMETER 766 */ 767 static unsubscribeBarometer(): void; 768 769 /** 770 * Listens to changes of heart rate sensor data. 771 * If this API is called multiple times, the last call takes effect. 772 * 773 * @permission ohos.permission.READ_HEALTH_DATA 774 * @param { SubscribeHeartRateOptions } options - options Options. 775 * @syscap SystemCapability.Sensors.Sensor.Lite 776 * @since 3 777 * @deprecated since 8 778 * @useinstead ohos.sensor/sensor.SensorId#HEART_RATE 779 */ 780 static subscribeHeartRate(options: SubscribeHeartRateOptions): void; 781 782 /** 783 * Cancels listening to heart rate sensor data. 784 * 785 * @permission ohos.permission.READ_HEALTH_DATA 786 * @syscap SystemCapability.Sensors.Sensor.Lite 787 * @since 3 788 * @deprecated since 8 789 * @useinstead ohos.sensor/sensor.SensorId#HEART_RATE 790 */ 791 static unsubscribeHeartRate(): void; 792 793 /** 794 * Listens to whether a sensor is worn. 795 * If this API is called multiple times, the last call takes effect. 796 * 797 * @param { SubscribeOnBodyStateOptions } options - options Options. 798 * @syscap SystemCapability.Sensors.Sensor.Lite 799 * @since 3 800 * @deprecated since 8 801 * @useinstead ohos.sensor/sensor.SensorId#WEAR_DETECTION 802 */ 803 static subscribeOnBodyState(options: SubscribeOnBodyStateOptions): void; 804 805 /** 806 * Cancels listening to whether the sensor is worn. 807 * 808 * @syscap SystemCapability.Sensors.Sensor.Lite 809 * @since 3 810 * @deprecated since 8 811 * @useinstead ohos.sensor/sensor.SensorId#WEAR_DETECTION 812 */ 813 static unsubscribeOnBodyState(): void; 814 815 /** 816 * Obtains the sensor wearing state. 817 * 818 * @param { GetOnBodyStateOptions } options - options Options. 819 * @syscap SystemCapability.Sensors.Sensor.Lite 820 * @since 3 821 * @deprecated since 8 822 * @useinstead ohos.sensor/sensor.SensorId#WEAR_DETECTION 823 */ 824 static getOnBodyState(options: GetOnBodyStateOptions): void; 825 826 /** 827 * Listens to device orientation sensor data changes. 828 * If this API is called multiple times, the last call takes effect. 829 * 830 * @param { SubscribeDeviceOrientationOptions } options - options Options. 831 * @syscap SystemCapability.Sensors.Sensor.Lite 832 * @since 6 833 * @deprecated since 8 834 * @useinstead ohos.sensor/sensor.SensorId#ORIENTATION 835 */ 836 static subscribeDeviceOrientation(options: SubscribeDeviceOrientationOptions): void; 837 838 /** 839 * Cancels listening to device orientation sensor data. 840 * 841 * @syscap SystemCapability.Sensors.Sensor.Lite 842 * @since 6 843 * @deprecated since 8 844 * @useinstead ohos.sensor/sensor.SensorId#ORIENTATION 845 */ 846 static unsubscribeDeviceOrientation(): void; 847 848 /** 849 * Listens to gyroscope sensor data changes. 850 * If this API is called multiple times, the last call takes effect. 851 * 852 * @permission ohos.permission.GYROSCOPE 853 * @param { SubscribeGyroscopeOptions } options - options Options. 854 * @syscap SystemCapability.Sensors.Sensor.Lite 855 * @since 6 856 * @deprecated since 8 857 * @useinstead ohos.sensor/sensor.SensorId#GYROSCOPE 858 */ 859 static subscribeGyroscope(options: SubscribeGyroscopeOptions): void; 860 861 /** 862 * Cancels listening to gyroscope sensor data. 863 * 864 * @permission ohos.permission.GYROSCOPE 865 * @syscap SystemCapability.Sensors.Sensor.Lite 866 * @since 6 867 * @deprecated since 8 868 * @useinstead ohos.sensor/sensor.SensorId#GYROSCOPE 869 */ 870 static unsubscribeGyroscope(): void; 871}