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