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 */ 15import { AsyncCallback, Callback } from "./basic"; 16 17/** 18 * This module provides the capability to subscribe to sensor data. 19 * 20 * @since 8 21 * @syscap SystemCapability.Sensors.Sensor 22 * @import import sensor from '@ohos.sensor' 23 * @permission ohos.permission.ACCELEROMETER, ohos.permission.GRYOSCOPE, 24 * ohos.permission.ACTIVITY_MOTION, ohos.permission.HEALTH_DATA 25 */ 26declare namespace sensor { 27 /** 28 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 29 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}. 30 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 31 * @permission ohos.permission.ACCELEROMETER 32 * @syscap SystemCapability.Sensors.Sensor 33 * @since 8 34 */ 35 function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<AccelerometerResponse>, 36 options?: Options): void; 37 38 /** 39 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 40 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}. 41 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 42 * @permission ohos.permission.ACCELEROMETER 43 * @syscap SystemCapability.Sensors.Sensor 44 * @since 8 45 */ 46 function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>, 47 options?: Options): void; 48 49 /** 50 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 51 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}. 52 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 53 * @syscap SystemCapability.Sensors.Sensor 54 * @permission N/A 55 * @since 8 56 */ 57 function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback<LightResponse>, 58 options?: Options): void; 59 60 /** 61 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 62 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}. 63 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 64 * @syscap SystemCapability.Sensors.Sensor 65 * @permission N/A 66 * @since 8 67 */ 68 function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>, 69 options?: Options): void; 70 71 /** 72 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 73 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_BAROMETER}. 74 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 75 * @syscap SystemCapability.Sensors.Sensor 76 * @permission N/A 77 * @since 8 78 */ 79 function on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback<BarometerResponse>, 80 options?: Options): void; 81 82 /** 83 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 84 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GRAVITY}. 85 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 86 * @syscap SystemCapability.Sensors.Sensor 87 * @permission N/A 88 * @since 8 89 */ 90 function on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback<GravityResponse>, 91 options?: Options): void; 92 93 /** 94 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 95 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}. 96 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 97 * @syscap SystemCapability.Sensors.Sensor 98 * @permission ohos.permission.GYROSCOPE 99 * @since 8 100 */ 101 function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback<GyroscopeResponse>, 102 options?: Options): void; 103 104 /** 105 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 106 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}. 107 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 108 * @syscap SystemCapability.Sensors.Sensor 109 * @permission ohos.permission.GYROSCOPE 110 * @since 8 111 */ 112 function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>, 113 options?: Options): void; 114 115 /** 116 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 117 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HALL}. 118 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 119 * @syscap SystemCapability.Sensors.Sensor 120 * @permission N/A 121 * @since 8 122 */ 123 function on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback<HallResponse>, 124 options?: Options): void; 125 126 /** 127 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 128 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}. 129 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 130 * @syscap SystemCapability.Sensors.Sensor 131 * @permission ohos.permission.READ_HEALTH_DATA 132 * @since 8 133 */ 134 function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRateResponse>, 135 options?: Options): void; 136 137 /** 138 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 139 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}. 140 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 141 * @syscap SystemCapability.Sensors.Sensor 142 * @permission N/A 143 * @since 8 144 */ 145 function on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback<HumidityResponse>, 146 options?: Options): void; 147 148 /** 149 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 150 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}. 151 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 152 * @syscap SystemCapability.Sensors.Sensor 153 * @permission ohos.permission.ACCELEROMETER 154 * @since 8 155 */ 156 function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback<LinearAccelerometerResponse>, 157 options?: Options): void; 158 159 /** 160 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 161 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}. 162 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 163 * @syscap SystemCapability.Sensors.Sensor 164 * @permission N/A 165 * @since 8 166 */ 167 function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>, 168 options?: Options): void; 169 170 /** 171 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 172 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}. 173 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 174 * @syscap SystemCapability.Sensors.Sensor 175 * @permission N/A 176 * @since 8 177 */ 178 function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>, 179 options?: Options): void; 180 181 /** 182 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 183 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}. 184 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 185 * @syscap SystemCapability.Sensors.Sensor 186 * @permission N/A 187 * @since 8 188 */ 189 function on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback<OrientationResponse>, 190 options?: Options): void; 191 192 /** 193 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 194 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}. 195 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 196 * @syscap SystemCapability.Sensors.Sensor 197 * @permission ohos.permission.ACTIVITY_MOTION 198 * @since 8 199 */ 200 function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback<PedometerResponse>, 201 options?: Options): void; 202 203 /** 204 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 205 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}. 206 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 207 * @syscap SystemCapability.Sensors.Sensor 208 * @permission ohos.permission.ACTIVITY_MOTION 209 * @since 8 210 */ 211 function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>, 212 options?: Options): void; 213 214 /** 215 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 216 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}. 217 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 218 * @syscap SystemCapability.Sensors.Sensor 219 * @permission N/A 220 * @since 8 221 */ 222 function on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback<ProximityResponse>, 223 options?: Options): void; 224 225 /** 226 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 227 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}. 228 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 229 * @syscap SystemCapability.Sensors.Sensor 230 * @permission N/A 231 * @since 8 232 */ 233 function on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback<RotationVectorResponse>, 234 options?: Options): void; 235 236 /** 237 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 238 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}. 239 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 240 * @syscap SystemCapability.Sensors.Sensor 241 * @permission N/A 242 * @since 8 243 */ 244 function on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>, 245 options?: Options): void; 246 247 /** 248 * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. 249 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}. 250 * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. 251 * @syscap SystemCapability.Sensors.Sensor 252 * @permission N/A 253 * @since 8 254 */ 255 function on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback<WearDetectionResponse>, 256 options?: Options): void; 257 258 /** 259 * Subscribe to sensor data once. 260 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}. 261 * @syscap SystemCapability.Sensors.Sensor 262 * @permission ohos.permission.ACCELEROMETER 263 * @since 8 264 */ 265 function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<AccelerometerResponse>): void; 266 267 /** 268 * Subscribe to sensor data once. 269 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}. 270 * @syscap SystemCapability.Sensors.Sensor 271 * @permission ohos.permission.ACCELEROMETER 272 * @since 8 273 */ 274 function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>): void; 275 276 /** 277 * Subscribe to sensor data once. 278 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}. 279 * @syscap SystemCapability.Sensors.Sensor 280 * @permission N/A 281 * @since 8 282 */ 283 function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback<LightResponse>): void; 284 285 /** 286 * Subscribe to sensor data once. 287 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}. 288 * @syscap SystemCapability.Sensors.Sensor 289 * @permission N/A 290 * @since 8 291 */ 292 function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>): void; 293 294 /** 295 * Subscribe to sensor data once. 296 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_BAROMETER}. 297 * @syscap SystemCapability.Sensors.Sensor 298 * @permission N/A 299 * @since 8 300 */ 301 function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback<BarometerResponse>): void; 302 303 /** 304 * Subscribe to sensor data once. 305 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GRAVITY}. 306 * @syscap SystemCapability.Sensors.Sensor 307 * @permission N/A 308 * @since 8 309 */ 310 function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback<GravityResponse>): void; 311 312 /** 313 * Subscribe to sensor data once. 314 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}. 315 * @syscap SystemCapability.Sensors.Sensor 316 * @permission ohos.permission.GYROSCOPE 317 * @since 8 318 */ 319 function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback<GyroscopeResponse>): void; 320 321 /** 322 * Subscribe to sensor data once. 323 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}. 324 * @syscap SystemCapability.Sensors.Sensor 325 * @permission ohos.permission.GYROSCOPE 326 * @since 8 327 */ 328 function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>): void; 329 330 /** 331 * Subscribe to sensor data once. 332 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HALL}. 333 * @syscap SystemCapability.Sensors.Sensor 334 * @permission N/A 335 * @since 8 336 */ 337 function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback<HallResponse>): void; 338 339 /** 340 * Subscribe to sensor data once. 341 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}. 342 * @syscap SystemCapability.Sensors.Sensor 343 * @permission ohos.permission.READ_HEALTH_DATA 344 * @since 8 345 */ 346 function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRateResponse>): void; 347 348 /** 349 * Subscribe to sensor data once. 350 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}. 351 * @syscap SystemCapability.Sensors.Sensor 352 * @permission N/A 353 * @since 8 354 */ 355 function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback<HumidityResponse>): void; 356 357 /** 358 * Subscribe to sensor data once. 359 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}. 360 * @syscap SystemCapability.Sensors.Sensor 361 * @permission ohos.permission.ACCELERATION 362 * @since 8 363 */ 364 function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback<LinearAccelerometerResponse>): void; 365 366 /** 367 * Subscribe to sensor data once. 368 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}. 369 * @syscap SystemCapability.Sensors.Sensor 370 * @permission N/A 371 * @since 8 372 */ 373 function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>): void; 374 375 /** 376 * Subscribe to sensor data once. 377 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}. 378 * @syscap SystemCapability.Sensors.Sensor 379 * @permission N/A 380 * @since 8 381 */ 382 function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>): void; 383 384 /** 385 * Subscribe to sensor data once. 386 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}. 387 * @syscap SystemCapability.Sensors.Sensor 388 * @permission N/A 389 * @since 8 390 */ 391 function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback<OrientationResponse>): void; 392 393 /** 394 * Subscribe to sensor data once. 395 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}. 396 * @syscap SystemCapability.Sensors.Sensor 397 * @permission ohos.permission.ACTIVITY_MOTION 398 * @since 8 399 */ 400 function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback<PedometerResponse>): void; 401 402 /** 403 * Subscribe to sensor data once. 404 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}. 405 * @syscap SystemCapability.Sensors.Sensor 406 * @permission ohos.permission.ACTIVITY_MOTION 407 * @since 8 408 */ 409 function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>): void; 410 411 /** 412 * Subscribe to sensor data once. 413 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}. 414 * @syscap SystemCapability.Sensors.Sensor 415 * @permission N/A 416 * @since 8 417 */ 418 function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback<ProximityResponse>): void; 419 420 /** 421 * Subscribe to sensor data once. 422 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}. 423 * @syscap SystemCapability.Sensors.Sensor 424 * @permission N/A 425 * @since 8 426 */ 427 function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback<RotationVectorResponse>): void; 428 429 /** 430 * Subscribe to sensor data once. 431 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}. 432 * @syscap SystemCapability.Sensors.Sensor 433 * @permission N/A 434 * @since 8 435 */ 436 function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>): void; 437 438 /** 439 * Subscribe to sensor data once. 440 * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}. 441 * @syscap SystemCapability.Sensors.Sensor 442 * @permission N/A 443 * @since 8 444 */ 445 function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback<WearDetectionResponse>): void; 446 447 /** 448 * Unsubscribe to sensor data. 449 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}. 450 * @permission ohos.permission.ACCELEROMETER 451 * @syscap SystemCapability.Sensors.Sensor 452 * @since 8 453 */ 454 function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback?: Callback<AccelerometerResponse>): void; 455 456 /** 457 * Unsubscribe to sensor data. 458 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}. 459 * @permission ohos.permission.ACCELEROMETER 460 * @syscap SystemCapability.Sensors.Sensor 461 * @since 8 462 */ 463 function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, 464 callback?: Callback<AccelerometerUncalibratedResponse>): void; 465 466 /** 467 * Unsubscribe to sensor data. 468 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}. 469 * @syscap SystemCapability.Sensors.Sensor 470 * @permission N/A 471 * @since 8 472 */ 473 function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback?: Callback<LightResponse>): void; 474 475 /** 476 * Unsubscribe to sensor data. 477 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}. 478 * @syscap SystemCapability.Sensors.Sensor 479 * @permission N/A 480 * @since 8 481 */ 482 function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback?: Callback<AmbientTemperatureResponse>): void; 483 484 /** 485 * Unsubscribe to sensor data. 486 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_BAROMETER}. 487 * @syscap SystemCapability.Sensors.Sensor 488 * @permission N/A 489 * @since 8 490 */ 491 function off(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback?: Callback<BarometerResponse>): void; 492 493 /** 494 * Unsubscribe to sensor data. 495 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_GRAVITY}. 496 * @syscap SystemCapability.Sensors.Sensor 497 * @permission N/A 498 * @since 8 499 */ 500 function off(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback?: Callback<GravityResponse>): void; 501 502 /** 503 * Unsubscribe to sensor data. 504 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}. 505 * @syscap SystemCapability.Sensors.Sensor 506 * @permission ohos.permission.GYROSCOPE 507 * @since 8 508 */ 509 function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback?: Callback<GyroscopeResponse>): void; 510 511 /** 512 * Unsubscribe to sensor data. 513 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}. 514 * @syscap SystemCapability.Sensors.Sensor 515 * @permission ohos.permission.GYROSCOPE 516 * @since 8 517 */ 518 function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback<GyroscopeUncalibratedResponse>): void; 519 520 /** 521 * Unsubscribe to sensor data. 522 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_HALL}. 523 * @syscap SystemCapability.Sensors.Sensor 524 * @permission N/A 525 * @since 8 526 */ 527 function off(type: SensorType.SENSOR_TYPE_ID_HALL, callback?: Callback<HallResponse>): void; 528 529 /** 530 * Unsubscribe to sensor data. 531 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}. 532 * @syscap SystemCapability.Sensors.Sensor 533 * @permission ohos.permission.READ_HEALTH_DATA 534 * @since 8 535 */ 536 function off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback<HeartRateResponse>): void; 537 538 /** 539 * Unsubscribe to sensor data. 540 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}. 541 * @syscap SystemCapability.Sensors.Sensor 542 * @permission N/A 543 * @since 8 544 */ 545 function off(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback?: Callback<HumidityResponse>): void; 546 547 /** 548 * Unsubscribe to sensor data. 549 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}. 550 * @syscap SystemCapability.Sensors.Sensor 551 * @permission ohos.permission.ACCELEROMETER 552 * @since 8 553 */ 554 function off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback<LinearAccelerometerResponse>): void; 555 556 /** 557 * Unsubscribe to sensor data. 558 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}. 559 * @syscap SystemCapability.Sensors.Sensor 560 * @permission N/A 561 * @since 8 562 */ 563 function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback?: Callback<MagneticFieldResponse>): void; 564 565 /** 566 * Unsubscribe to sensor data. 567 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}. 568 * @syscap SystemCapability.Sensors.Sensor 569 * @permission N/A 570 * @since 8 571 */ 572 function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback?: Callback<MagneticFieldUncalibratedResponse>): void; 573 574 /** 575 * Unsubscribe to sensor data. 576 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}. 577 * @syscap SystemCapability.Sensors.Sensor 578 * @permission N/A 579 * @since 8 580 */ 581 function off(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback?: Callback<OrientationResponse>): void; 582 583 /** 584 * Unsubscribe to sensor data. 585 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}. 586 * @syscap SystemCapability.Sensors.Sensor 587 * @permission ohos.permission.ACTIVITY_MOTION 588 * @since 8 589 */ 590 function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback?: Callback<PedometerResponse>): void; 591 592 /** 593 * Unsubscribe to sensor data. 594 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}. 595 * @syscap SystemCapability.Sensors.Sensor 596 * @permission ohos.permission.ACTIVITY_MOTION 597 * @since 8 598 */ 599 function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback?: Callback<PedometerDetectionResponse>): void; 600 601 /** 602 * Unsubscribe to sensor data. 603 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}. 604 * @syscap SystemCapability.Sensors.Sensor 605 * @permission N/A 606 * @since 8 607 */ 608 function off(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback?: Callback<ProximityResponse>): void; 609 610 /** 611 * Unsubscribe to sensor data. 612 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}. 613 * @syscap SystemCapability.Sensors.Sensor 614 * @permission N/A 615 * @since 8 616 */ 617 function off(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback?: Callback<RotationVectorResponse>): void; 618 619 /** 620 * Unsubscribe to sensor data. 621 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}. 622 * @syscap SystemCapability.Sensors.Sensor 623 * @permission N/A 624 * @since 8 625 */ 626 function off(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback?: Callback<SignificantMotionResponse>): void; 627 628 /** 629 * Unsubscribe to sensor data. 630 * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}. 631 * @syscap SystemCapability.Sensors.Sensor 632 * @permission N/A 633 * @since 8 634 */ 635 function off(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback?: Callback<WearDetectionResponse>): void; 636 637 /** 638 * Indicates geographic location. 639 * @syscap SystemCapability.Sensors.Sensor 640 * @since 8 641 */ 642 interface LocationOptions { 643 latitude: number; 644 longitude: number; 645 altitude: number; 646 } 647 648 /** 649 * Indicates geomagnetic field data. 650 * @syscap SystemCapability.Sensors.Sensor 651 * @since 8 652 */ 653 interface GeomagneticResponse { 654 x: number; 655 y: number; 656 z: number; 657 geomagneticDip: number; 658 deflectionAngle: number; 659 levelIntensity: number; 660 totalIntensity: number; 661 } 662 663 /** 664 * Implements the calculation of the geomagnetic field at a specific location on Earth. 665 * 666 * @param LocationOptions Indicates geographic location, {@code LocationOptions}. 667 * @param timeMillis Indicates the time at which the magnetic declination is to be obtained, in milliseconds 668 * since the Unix epoch. 669 * @return Returns the geomagnetic field data, {@code GeomagneticResponse}. 670 * @syscap SystemCapability.Sensors.Sensor 671 * @since 8 672 */ 673 function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback<GeomagneticResponse>): void; 674 function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise<GeomagneticResponse>; 675 676 /** 677 * Obtains the altitude at which the device is located based on the current atmospheric pressure. 678 * 679 * @param seaPressure Indicates the sea level pressure, in hPa. 680 * @param currentPressure Indicates the atmospheric pressure measured by the barometer, in hPa. 681 * @return Returns the altitude in meters at which the device is located. 682 * @syscap SystemCapability.Sensors.Sensor 683 * @since 8 684 */ 685 function getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback<number>): void; 686 function getAltitude(seaPressure: number, currentPressure: number): Promise<number>; 687 688 /** 689 * Computes the geomagnetic inclination angle in radians from the inclination matrix. 690 * 691 * @param inclinationMatrix Indicates the inclination matrix. 692 * @return Returns the geomagnetic inclination angle in radians. 693 * @syscap SystemCapability.Sensors.Sensor 694 * @since 8 695 */ 696 function getGeomagneticDip(inclinationMatrix: Array<number>, callback: AsyncCallback<number>): void; 697 function getGeomagneticDip(inclinationMatrix: Array<number>): Promise<number>; 698 699 /** 700 * Get the angle change between two rotation matrices 701 * 702 * @param currentRotationMatrix Indicates the current rotation matrix. 703 * @param preRotationMatrix Indicates the current rotation matrix. 704 * @return Returns the array of number(z, x and y) in which the angle variety. 705 * @syscap SystemCapability.Sensors.Sensor 706 * @since 8 707 */ 708 function getAngleModify(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>, 709 callback: AsyncCallback<Array<number>>): void; 710 function getAngleModify(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise<Array<number>>; 711 712 /** 713 * Convert rotation vector to rotation matrix. 714 * 715 * @param rotationVector Indicates the rotation vector. 716 * @return Returns the rotation matrix. 717 * @syscap SystemCapability.Sensors.Sensor 718 * @since 8 719 */ 720 function createRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void; 721 function createRotationMatrix(rotationVector: Array<number>): Promise<Array<number>>; 722 723 /** 724 * Indicates the axis of the new coordinate system that coincides with the XY axis of the 725 * original coordinate system. 726 * @syscap SystemCapability.Sensors.Sensor 727 * @since 8 728 */ 729 interface CoordinatesOptions { 730 /** Indicates the axis of the new coordinate system that coincides with the X axis of 731 * the original coordinate system. 732 */ 733 x: number; 734 /** Indicates the axis of the new coordinate system that coincides with the Z axis of 735 * the original coordinate system. 736 */ 737 y: number; 738 } 739 740 /** 741 * Rotate the provided rotation matrix so that it can be represented in a different way 742 * Coordinate System 743 * @param inRotationVector Indicates the rotation matrix to be transformed. 744 * @param coordinates Indicates coordinate system guidance, {@code CoordinatesOptions}. 745 * @return Returns the transformed rotation matrix. 746 * @syscap SystemCapability.Sensors.Sensor 747 * @since 8 748 */ 749 function transformCoordinateSystem(inRotationVector: Array<number>, coordinates: CoordinatesOptions, 750 callback: AsyncCallback<Array<number>>): void; 751 function transformCoordinateSystem(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise<Array<number>>; 752 753 /** 754 * convert a rotation vector to a normalized quaternion. 755 * 756 * @param rotationVector Indicates the rotation vector. 757 * @return Returns the normalized quaternion. 758 * @syscap SystemCapability.Sensors.Sensor 759 * @since 8 760 */ 761 function createQuaternion(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void; 762 function createQuaternion(rotationVector: Array<number>): Promise<Array<number>>; 763 764 /** 765 * Computes the device's orientation based on the rotation matrix. 766 * 767 * @param rotationMatrix Indicates the rotation matrix. 768 * @return Returns the array is the angle of rotation around the z, x, y axis. 769 * @syscap SystemCapability.Sensors.Sensor 770 * @since 8 771 */ 772 function getDirection(rotationMatrix: Array<number>, callback: AsyncCallback<Array<number>>): void; 773 function getDirection(rotationMatrix: Array<number>): Promise<Array<number>>; 774 775 /** 776 * Indicates the response of rotation matrix. 777 * @syscap SystemCapability.Sensors.Sensor 778 * @since 8 779 */ 780 interface RotationMatrixResponse { 781 rotation: Array<number>; 782 inclination: Array<number> 783 } 784 785 /** 786 * Calculate rotation matrix based on gravity vector and geomagnetic vector. 787 * 788 * @param gravity Indicates the gravity vector. 789 * @param geomagnetic Indicates the geomagnetic vector. 790 * @return Returns the rotation matrix, {@code RotationMatrixResponse}. 791 * @syscap SystemCapability.Sensors.Sensor 792 * @since 8 793 */ 794 function createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>, callback: AsyncCallback<RotationMatrixResponse>): void; 795 function createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>,): Promise<RotationMatrixResponse>; 796 797 /** 798 * Subscribe to the sensor's optional parameters. 799 * @syscap SystemCapability.Sensors.Sensor 800 * @since 8 801 */ 802 interface Options { 803 interval?: number; /**< Sensor event reporting event interval */ 804 } 805 806 /** 807 * The type of sensor. 808 * @syscap SystemCapability.Sensors.Sensor 809 * @since 8 810 */ 811 enum SensorType { 812 SENSOR_TYPE_ID_ACCELEROMETER = 1, /**< Acceleration sensor */ 813 SENSOR_TYPE_ID_GYROSCOPE = 2, /**< Gyroscope sensor */ 814 SENSOR_TYPE_ID_AMBIENT_LIGHT = 5, /**< Ambient light sensor */ 815 SENSOR_TYPE_ID_MAGNETIC_FIELD = 6, /**< Magnetic field sensor */ 816 SENSOR_TYPE_ID_BAROMETER = 8, /**< Barometric pressure sensor */ 817 SENSOR_TYPE_ID_HALL = 10, /**< Hall effect sensor */ 818 SENSOR_TYPE_ID_PROXIMITY = 12, /**< Proximity sensor */ 819 SENSOR_TYPE_ID_HUMIDITY = 13, /**< Humidity sensor */ 820 SENSOR_TYPE_ID_ORIENTATION = 256, /**< Orientation sensor */ 821 SENSOR_TYPE_ID_GRAVITY = 257, /**< Gravity sensor */ 822 SENSOR_TYPE_ID_LINEAR_ACCELERATION = 258, /**< Linear acceleration sensor */ 823 SENSOR_TYPE_ID_ROTATION_VECTOR = 259, /**< Rotation vector sensor */ 824 SENSOR_TYPE_ID_AMBIENT_TEMPERATURE = 260, /**< Ambient temperature sensor */ 825 SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED = 261, /**< Uncalibrated magnetic field sensor */ 826 SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED = 263, /**< Uncalibrated gyroscope sensor */ 827 SENSOR_TYPE_ID_SIGNIFICANT_MOTION = 264, /**< Significant motion sensor */ 828 SENSOR_TYPE_ID_PEDOMETER_DETECTION = 265, /**< Pedometer detection sensor */ 829 SENSOR_TYPE_ID_PEDOMETER = 266, /**< Pedometer sensor */ 830 SENSOR_TYPE_ID_HEART_RATE = 278, /**< Heart rate sensor */ 831 SENSOR_TYPE_ID_WEAR_DETECTION = 280, /**< Wear detection sensor */ 832 SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED = 281, /**< Uncalibrated acceleration sensor */ 833 } 834 835 /** 836 * The basic data structure of the sensor event. 837 * @syscap SystemCapability.Sensors.Sensor 838 * @since 8 839 */ 840 interface Response { 841 timestamp: number; /**< The timestamp of the reported sensor data */ 842 } 843 844 /** 845 * Acceleration sensor event data. 846 * @syscap SystemCapability.Sensors.Sensor 847 * @since 8 848 */ 849 interface AccelerometerResponse extends Response { 850 x: number; /**< Acceleration x-axis component */ 851 y: number; /**< Acceleration y-axis component */ 852 z: number; /**< Acceleration z-axis component */ 853 } 854 855 /** 856 * Linear acceleration sensor event data. 857 * @syscap SystemCapability.Sensors.Sensor 858 * @since 8 859 */ 860 interface LinearAccelerometerResponse extends Response{ 861 x: number; /**< Linear acceleration x-axis component */ 862 y: number; /**< Linear acceleration y-axis component */ 863 z: number; /**< Linear acceleration z-axis component */ 864 } 865 866 /** 867 * Acceleration uncalibrated sensor event data. 868 * @syscap SystemCapability.Sensors.Sensor 869 * @since 8 870 */ 871 interface AccelerometerUncalibratedResponse extends Response { 872 x: number; /**< Acceleration uncalibrated x-axis component */ 873 y: number; /**< Acceleration uncalibrated y-axis component */ 874 z: number; /**< Acceleration uncalibrated z-axis component */ 875 biasX: number; /**< Acceleration uncalibrated x-axis offset */ 876 biasY: number; /**< Acceleration uncalibrated y-axis offset */ 877 biasZ: number; /**< Acceleration uncalibrated z-axis offset */ 878 } 879 880 /** 881 * Gravity sensor event data. 882 * @syscap SystemCapability.Sensors.Sensor 883 * @since 8 884 */ 885 interface GravityResponse extends Response { 886 x: number; /**< Gravity x-axis component */ 887 y: number; /**< Gravity y-axis component */ 888 z: number; /**< Gravity z-axis component */ 889 } 890 891 /** 892 * Orientation sensor event data. 893 * @syscap SystemCapability.Sensors.Sensor 894 * @since 8 895 */ 896 interface OrientationResponse extends Response { 897 alpha: number; /**< The device rotates at an angle around the Z axis */ 898 beta: number; /**< The device rotates at an angle around the X axis */ 899 gamma: number; /**< The device rotates at an angle around the Y axis */ 900 } 901 902 /** 903 * Rotation vector sensor event data. 904 * @syscap SystemCapability.Sensors.Sensor 905 * @since 8 906 */ 907 interface RotationVectorResponse extends Response { 908 x: number; /**< Rotation vector x-axis component */ 909 y: number; /**< Rotation vector y-axis component */ 910 z: number; /**< Rotation vector z-axis component */ 911 w: number; /**< Scalar quantity */ 912 } 913 914 /** 915 * Gyroscope sensor event data. 916 * @syscap SystemCapability.Sensors.Sensor 917 * @since 8 918 */ 919 interface GyroscopeResponse extends Response { 920 x: number; /**< Gyroscope x-axis component */ 921 y: number; /**< Gyroscope y-axis component */ 922 z: number; /**< Gyroscope z-axis component */ 923 } 924 925 /** 926 * Gyroscope uncalibrated sensor event data. 927 * @syscap SystemCapability.Sensors.Sensor 928 * @since 8 929 */ 930 interface GyroscopeUncalibratedResponse extends Response { 931 x: number; /**< Gyroscope uncalibrated x-axis component */ 932 y: number; /**< Gyroscope uncalibrated y-axis component */ 933 z: number; /**< Gyroscope uncalibrated z-axis component */ 934 biasX: number; /**< Gyroscope uncalibrated x-axis offset */ 935 biasY: number; /**< Gyroscope uncalibrated y-axis offset */ 936 biasZ: number; /**< Gyroscope uncalibrated z-axis offset */ 937 } 938 939 /** 940 * Significant motion sensor event data. 941 * @syscap SystemCapability.Sensors.Sensor 942 * @since 8 943 */ 944 interface SignificantMotionResponse extends Response { 945 scalar: number; /**< The degree of significant motion */ 946 } 947 948 /** 949 * Proximity sensor event data. 950 * @syscap SystemCapability.Sensors.Sensor 951 * @since 8 952 */ 953 interface ProximityResponse extends Response { 954 distance: number; /**< Indicates the degree of proximity, event 0 indicates proximity, while 1 indicates distance */ 955 } 956 957 /** 958 * Light sensor event data. 959 * @syscap SystemCapability.Sensors.Sensor 960 * @since 8 961 */ 962 interface LightResponse extends Response { 963 intensity: number; /**< Indicates light intensity, in lux */ 964 } 965 966 /** 967 * Hall sensor event data. 968 * @syscap SystemCapability.Sensors.Sensor 969 * @since 8 970 */ 971 interface HallResponse extends Response { 972 status: number; /**< Indicates hall status, event 0 indicates open, while 1 indicates close*/ 973 } 974 975 /** 976 * Magnetic field sensor event data. 977 * @syscap SystemCapability.Sensors.Sensor 978 * @since 8 979 */ 980 interface MagneticFieldResponse extends Response { 981 x: number; /**< Magnetic field x-axis component */ 982 y: number; /**< Magnetic field y-axis component */ 983 z: number; /**< Magnetic field z-axis component */ 984 } 985 986 /** 987 * Magnetic field uncalibrated sensor event data. 988 * @syscap SystemCapability.Sensors.Sensor 989 * @since 8 990 */ 991 interface MagneticFieldUncalibratedResponse extends Response { 992 x: number; /**< Magnetic field uncalibrated x-axis component */ 993 y: number; /**< Magnetic field uncalibrated y-axis component */ 994 z: number; /**< Magnetic field uncalibrated z-axis component */ 995 biasX: number; /**< Magnetic field uncalibrated x-axis offset */ 996 biasY: number; /**< Magnetic field uncalibrated y-axis offset */ 997 biasZ: number; /**< Magnetic field uncalibrated z-axis offset */ 998 } 999 1000 /** 1001 * Pedometer sensor event data. 1002 * @syscap SystemCapability.Sensors.Sensor 1003 * @since 8 1004 */ 1005 interface PedometerResponse extends Response { 1006 steps: number; /**< Indicates the number of steps */ 1007 } 1008 1009 /** 1010 * Humidity sensor event data. 1011 * @syscap SystemCapability.Sensors.Sensor 1012 * @since 8 1013 */ 1014 interface HumidityResponse extends Response { 1015 humidity: number; /**< Indicates the number of humidity */ 1016 } 1017 1018 /** 1019 * Pedometer detection sensor event data. 1020 * @syscap SystemCapability.Sensors.Sensor 1021 * @since 8 1022 */ 1023 interface PedometerDetectionResponse extends Response { 1024 scalar: number; /**< Indicates the pedometer detection status, 1 indicates that a walking action has occurred, and 0 indicates that no movement has occurred */ 1025 } 1026 1027 /** 1028 * Ambient temperature sensor event data. 1029 * @syscap SystemCapability.Sensors.Sensor 1030 * @since 8 1031 */ 1032 interface AmbientTemperatureResponse extends Response { 1033 temperature: number; /**< Indicates ambient temperature, in celsius */ 1034 } 1035 1036 /** 1037 * Barometer sensor event data. 1038 * @syscap SystemCapability.Sensors.Sensor 1039 * @since 8 1040 */ 1041 interface BarometerResponse extends Response { 1042 pressure: number; /**< Indicates the number of barometer, in pascal */ 1043 } 1044 1045 /** 1046 * Heart rate sensor event data. 1047 * @syscap SystemCapability.Sensors.Sensor 1048 * @since 8 1049 */ 1050 interface HeartRateResponse extends Response { 1051 heartRate: number; /**< Indicates the number of heart rate */ 1052 } 1053 1054 /** 1055 * Wear detection sensor event data. 1056 * @syscap SystemCapability.Sensors.Sensor 1057 * @since 8 1058 */ 1059 interface WearDetectionResponse extends Response { 1060 value: number; /**< Indicates the status of wear detection, 1 for wearing, 0 for wearing not */ 1061 } 1062 } 1063 1064 export default sensor;