1# JS API Changes of the Pan-Sensor Subsystem 2 3The table below lists the APIs changes of the pan-sensor subsystem in OpenHarmony 3.1 Release over OpenHarmony 3.0 LTS. 4 5## API Changes 6 7| Module| Class| Method/Attribute/Enumeration/Constant| Change Type| 8|---|---|---|---| 9| ohos.vibrator | VibratorStopMode | VIBRATOR_STOP_MODE_PRESET = "preset" | Added| 10| ohos.vibrator | VibratorStopMode | VIBRATOR_STOP_MODE_TIME = "time" | Added| 11| ohos.vibrator | EffectId | EFFECT_CLOCK_TIMER = "haptic.clock.timer" | Added| 12| ohos.vibrator | vibrator | stop(stopMode: VibratorStopMode): Promise\<void>;<br>stop(stopMode: VibratorStopMode, callback?: AsyncCallback\<void>): void; | Added| 13| ohos.vibrator | vibrator | vibrate(duration: number, callback?: AsyncCallback\<void>): void;<br>vibrate(duration: number): Promise\<void>;<br>vibrate(effectId: EffectId): Promise\<void>;<br>vibrate(effectId: EffectId, callback?: AsyncCallback\<void>): void; | Added| 14| ohos.sensor | WearDetectionResponse | value: number; | Added| 15| ohos.sensor | HeartRateResponse | heartRate: number; | Added| 16| ohos.sensor | BarometerResponse | pressure: number; | Added| 17| ohos.sensor | AmbientTemperatureResponse | temperature: number; | Added| 18| ohos.sensor | PedometerDetectionResponse | scalar: number; | Added| 19| ohos.sensor | HumidityResponse | humidity: number; | Added| 20| ohos.sensor | PedometerResponse | steps: number; | Added| 21| ohos.sensor | MagneticFieldUncalibratedResponse | biasZ: number; | Added| 22| ohos.sensor | MagneticFieldUncalibratedResponse | biasY: number; | Added| 23| ohos.sensor | MagneticFieldUncalibratedResponse | biasX: number; | Added| 24| ohos.sensor | MagneticFieldUncalibratedResponse | z: number; | Added| 25| ohos.sensor | MagneticFieldUncalibratedResponse | y: number; | Added| 26| ohos.sensor | MagneticFieldUncalibratedResponse | x: number; | Added| 27| ohos.sensor | MagneticFieldResponse | z: number; | Added| 28| ohos.sensor | MagneticFieldResponse | y: number; | Added| 29| ohos.sensor | MagneticFieldResponse | x: number; | Added| 30| ohos.sensor | HallResponse | status: number; | Added| 31| ohos.sensor | LightResponse | intensity: number; | Added| 32| ohos.sensor | ProximityResponse | distance: number; | Added| 33| ohos.sensor | SignificantMotionResponse | scalar: number; | Added| 34| ohos.sensor | GyroscopeUncalibratedResponse | biasZ: number; | Added| 35| ohos.sensor | GyroscopeUncalibratedResponse | biasY: number; | Added| 36| ohos.sensor | GyroscopeUncalibratedResponse | biasX: number; | Added| 37| ohos.sensor | GyroscopeUncalibratedResponse | z: number; | Added| 38| ohos.sensor | GyroscopeUncalibratedResponse | y: number; | Added| 39| ohos.sensor | GyroscopeUncalibratedResponse | x: number; | Added| 40| ohos.sensor | GyroscopeResponse | z: number; | Added| 41| ohos.sensor | GyroscopeResponse | y: number; | Added| 42| ohos.sensor | GyroscopeResponse | x: number; | Added| 43| ohos.sensor | RotationVectorResponse | w: number; | Added| 44| ohos.sensor | RotationVectorResponse | z: number; | Added| 45| ohos.sensor | RotationVectorResponse | y: number; | Added| 46| ohos.sensor | RotationVectorResponse | x: number; | Added| 47| ohos.sensor | OrientationResponse | gamma: number; | Added| 48| ohos.sensor | OrientationResponse | beta: number; | Added| 49| ohos.sensor | OrientationResponse | alpha: number; | Added| 50| ohos.sensor | GravityResponse | z: number; | Added| 51| ohos.sensor | GravityResponse | y: number; | Added| 52| ohos.sensor | GravityResponse | x: number; | Added| 53| ohos.sensor | AccelerometerUncalibratedResponse | biasZ: number; | Added| 54| ohos.sensor | AccelerometerUncalibratedResponse | biasY: number; | Added| 55| ohos.sensor | AccelerometerUncalibratedResponse | biasX: number; | Added| 56| ohos.sensor | AccelerometerUncalibratedResponse | z: number; | Added| 57| ohos.sensor | AccelerometerUncalibratedResponse | y: number; | Added| 58| ohos.sensor | AccelerometerUncalibratedResponse | x: number; | Added| 59| ohos.sensor | LinearAccelerometerResponse | z: number; | Added| 60| ohos.sensor | LinearAccelerometerResponse | y: number; | Added| 61| ohos.sensor | LinearAccelerometerResponse | x: number; | Added| 62| ohos.sensor | AccelerometerResponse | z: number; | Added| 63| ohos.sensor | AccelerometerResponse | y: number; | Added| 64| ohos.sensor | AccelerometerResponse | x: number; | Added| 65| ohos.sensor | Response | timestamp: number; | Added| 66| ohos.sensor | SensorType | SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED = 281 | Added| 67| ohos.sensor | SensorType | SENSOR_TYPE_ID_WEAR_DETECTION = 280 | Added| 68| ohos.sensor | SensorType | SENSOR_TYPE_ID_HEART_RATE = 278 | Added| 69| ohos.sensor | SensorType | SENSOR_TYPE_ID_PEDOMETER = 266 | Added| 70| ohos.sensor | SensorType | SENSOR_TYPE_ID_PEDOMETER_DETECTION = 265 | Added| 71| ohos.sensor | SensorType | SENSOR_TYPE_ID_SIGNIFICANT_MOTION = 264 | Added| 72| ohos.sensor | SensorType | SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED = 263 | Added| 73| ohos.sensor | SensorType | SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED = 261 | Added| 74| ohos.sensor | SensorType | SENSOR_TYPE_ID_AMBIENT_TEMPERATURE = 260 | Added| 75| ohos.sensor | SensorType | SENSOR_TYPE_ID_ROTATION_VECTOR = 259 | Added| 76| ohos.sensor | SensorType | SENSOR_TYPE_ID_LINEAR_ACCELERATION = 258 | Added| 77| ohos.sensor | SensorType | SENSOR_TYPE_ID_GRAVITY = 257 | Added| 78| ohos.sensor | SensorType | SENSOR_TYPE_ID_ORIENTATION = 256 | Added| 79| ohos.sensor | SensorType | SENSOR_TYPE_ID_HUMIDITY = 13 | Added| 80| ohos.sensor | SensorType | SENSOR_TYPE_ID_PROXIMITY = 12 | Added| 81| ohos.sensor | SensorType | SENSOR_TYPE_ID_HALL = 10 | Added| 82| ohos.sensor | SensorType | SENSOR_TYPE_ID_BAROMETER = 8 | Added| 83| ohos.sensor | SensorType | SENSOR_TYPE_ID_MAGNETIC_FIELD = 6 | Added| 84| ohos.sensor | SensorType | SENSOR_TYPE_ID_AMBIENT_LIGHT = 5 | Added| 85| ohos.sensor | SensorType | SENSOR_TYPE_ID_GYROSCOPE = 2 | Added| 86| ohos.sensor | SensorType | SENSOR_TYPE_ID_ACCELEROMETER = 1 | Added| 87| ohos.sensor | Options | interval?: number; | Added| 88| ohos.sensor | RotationMatrixResponse | inclination: Array\<number> | Added| 89| ohos.sensor | RotationMatrixResponse | rotation: Array\<number>; | Added| 90| ohos.sensor | sensor | getDirection(rotationMatrix: Array\<number>, callback: AsyncCallback\<Array\<number>>): void;<br>getDirection(rotationMatrix: Array\<number>): Promise\<Array\<number>>; | Added| 91| ohos.sensor | sensor | createQuaternion(rotationVector: Array\<number>, callback: AsyncCallback\<Array\<number>>): void;<br>createQuaternion(rotationVector: Array\<number>): Promise\<Array\<number>>; | Added| 92| ohos.sensor | sensor | transformCoordinateSystem(inRotationVector: Array\<number>, coordinates: CoordinatesOptions, callback: AsyncCallback\<Array\<number>>): void;<br>transformCoordinateSystem(inRotationVector: Array\<number>, coordinates: CoordinatesOptions): Promise\<Array\<number>>; | Added| 93| ohos.sensor | CoordinatesOptions | y: number; | Added| 94| ohos.sensor | CoordinatesOptions | x: number; | Added| 95| ohos.sensor | sensor | createRotationMatrix(rotationVector: Array\<number>, callback: AsyncCallback\<Array\<number>>): void;<br>createRotationMatrix(rotationVector: Array\<number>): Promise\<Array\<number>>;<br>createRotationMatrix(gravity: Array\<number>, geomagnetic: Array\<number>, callback: AsyncCallback\<RotationMatrixResponse>): void;<br>createRotationMatrix(gravity: Array\<number>, geomagnetic: Array\<number>,): Promise\<RotationMatrixResponse>; | Added| 96| ohos.sensor | sensor | getAngleModify(currentRotationMatrix: Array\<number>, preRotationMatrix: Array\<number>, callback: AsyncCallback\<Array\<number>>): void;<br>getAngleModify(currentRotationMatrix: Array\<number>, preRotationMatrix: Array\<number>): Promise\<Array\<number>>; | Added| 97| ohos.sensor | sensor | getGeomagneticDip(inclinationMatrix: Array\<number>, callback: AsyncCallback\<number>): void;<br>getGeomagneticDip(inclinationMatrix: Array\<number>): Promise\<number>; | Added| 98| ohos.sensor | sensor | getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback\<number>): void;<br>getAltitude(seaPressure: number, currentPressure: number): Promise\<number>; | Added| 99| ohos.sensor | sensor | getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback\<GeomagneticResponse>): void;<br>getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise\<GeomagneticResponse>; | Added| 100| ohos.sensor | GeomagneticResponse | totalIntensity: number; | Added| 101| ohos.sensor | GeomagneticResponse | levelIntensity: number; | Added| 102| ohos.sensor | GeomagneticResponse | deflectionAngle: number; | Added| 103| ohos.sensor | GeomagneticResponse | geomagneticDip: number; | Added| 104| ohos.sensor | GeomagneticResponse | z: number; | Added| 105| ohos.sensor | GeomagneticResponse | y: number; | Added| 106| ohos.sensor | GeomagneticResponse | x: number; | Added| 107| ohos.sensor | LocationOptions | altitude: number; | Added| 108| ohos.sensor | LocationOptions | longitude: number; | Added| 109| ohos.sensor | LocationOptions | latitude: number; | Added| 110| ohos.sensor | sensor | off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback?: Callback\<AccelerometerResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback?: Callback\<AccelerometerUncalibratedResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback?: Callback\<LightResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback?: Callback\<AmbientTemperatureResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback?: Callback\<BarometerResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback?: Callback\<GravityResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback?: Callback\<GyroscopeResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback\<GyroscopeUncalibratedResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_HALL, callback?: Callback\<HallResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback\<HeartRateResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback?: Callback\<HumidityResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback\<LinearAccelerometerResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback?: Callback\<MagneticFieldResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback?: Callback\<MagneticFieldUncalibratedResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback?: Callback\<OrientationResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback?: Callback\<PedometerResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback?: Callback\<PedometerDetectionResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback?: Callback\<ProximityResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback?: Callback\<RotationVectorResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback?: Callback\<SignificantMotionResponse>): void;<br>off(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback?: Callback\<WearDetectionResponse>): void; | Added| 111| ohos.sensor | sensor | once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void; | Added| 112| ohos.sensor | sensor | on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>, options?: Options): void;<br>on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>, options?: Options): void; | Added| 113