harmony(鸿蒙)JS API Changes of the Pan-Sensor Subsystem

  • 2022-08-09
  • 浏览 (548)

JS API Changes of the Pan-Sensor Subsystem

The table below lists the APIs changes of the pan-sensor subsystem in OpenHarmony 3.1 Release over OpenHarmony 3.0 LTS.

API Changes

Module Class Method/Attribute/Enumeration/Constant Change Type
ohos.vibrator VibratorStopMode VIBRATOR_STOP_MODE_PRESET = “preset” Added
ohos.vibrator VibratorStopMode VIBRATOR_STOP_MODE_TIME = “time” Added
ohos.vibrator EffectId EFFECT_CLOCK_TIMER = “haptic.clock.timer” Added
ohos.vibrator vibrator stop(stopMode: VibratorStopMode): Promise<void>;
stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void;
Added
ohos.vibrator vibrator vibrate(duration: number, callback?: AsyncCallback<void>): void;
vibrate(duration: number): Promise<void>;
vibrate(effectId: EffectId): Promise<void>;
vibrate(effectId: EffectId, callback?: AsyncCallback<void>): void;
Added
ohos.sensor WearDetectionResponse value: number; Added
ohos.sensor HeartRateResponse heartRate: number; Added
ohos.sensor BarometerResponse pressure: number; Added
ohos.sensor AmbientTemperatureResponse temperature: number; Added
ohos.sensor PedometerDetectionResponse scalar: number; Added
ohos.sensor HumidityResponse humidity: number; Added
ohos.sensor PedometerResponse steps: number; Added
ohos.sensor MagneticFieldUncalibratedResponse biasZ: number; Added
ohos.sensor MagneticFieldUncalibratedResponse biasY: number; Added
ohos.sensor MagneticFieldUncalibratedResponse biasX: number; Added
ohos.sensor MagneticFieldUncalibratedResponse z: number; Added
ohos.sensor MagneticFieldUncalibratedResponse y: number; Added
ohos.sensor MagneticFieldUncalibratedResponse x: number; Added
ohos.sensor MagneticFieldResponse z: number; Added
ohos.sensor MagneticFieldResponse y: number; Added
ohos.sensor MagneticFieldResponse x: number; Added
ohos.sensor HallResponse status: number; Added
ohos.sensor LightResponse intensity: number; Added
ohos.sensor ProximityResponse distance: number; Added
ohos.sensor SignificantMotionResponse scalar: number; Added
ohos.sensor GyroscopeUncalibratedResponse biasZ: number; Added
ohos.sensor GyroscopeUncalibratedResponse biasY: number; Added
ohos.sensor GyroscopeUncalibratedResponse biasX: number; Added
ohos.sensor GyroscopeUncalibratedResponse z: number; Added
ohos.sensor GyroscopeUncalibratedResponse y: number; Added
ohos.sensor GyroscopeUncalibratedResponse x: number; Added
ohos.sensor GyroscopeResponse z: number; Added
ohos.sensor GyroscopeResponse y: number; Added
ohos.sensor GyroscopeResponse x: number; Added
ohos.sensor RotationVectorResponse w: number; Added
ohos.sensor RotationVectorResponse z: number; Added
ohos.sensor RotationVectorResponse y: number; Added
ohos.sensor RotationVectorResponse x: number; Added
ohos.sensor OrientationResponse gamma: number; Added
ohos.sensor OrientationResponse beta: number; Added
ohos.sensor OrientationResponse alpha: number; Added
ohos.sensor GravityResponse z: number; Added
ohos.sensor GravityResponse y: number; Added
ohos.sensor GravityResponse x: number; Added
ohos.sensor AccelerometerUncalibratedResponse biasZ: number; Added
ohos.sensor AccelerometerUncalibratedResponse biasY: number; Added
ohos.sensor AccelerometerUncalibratedResponse biasX: number; Added
ohos.sensor AccelerometerUncalibratedResponse z: number; Added
ohos.sensor AccelerometerUncalibratedResponse y: number; Added
ohos.sensor AccelerometerUncalibratedResponse x: number; Added
ohos.sensor LinearAccelerometerResponse z: number; Added
ohos.sensor LinearAccelerometerResponse y: number; Added
ohos.sensor LinearAccelerometerResponse x: number; Added
ohos.sensor AccelerometerResponse z: number; Added
ohos.sensor AccelerometerResponse y: number; Added
ohos.sensor AccelerometerResponse x: number; Added
ohos.sensor Response timestamp: number; Added
ohos.sensor SensorType SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED = 281 Added
ohos.sensor SensorType SENSOR_TYPE_ID_WEAR_DETECTION = 280 Added
ohos.sensor SensorType SENSOR_TYPE_ID_HEART_RATE = 278 Added
ohos.sensor SensorType SENSOR_TYPE_ID_PEDOMETER = 266 Added
ohos.sensor SensorType SENSOR_TYPE_ID_PEDOMETER_DETECTION = 265 Added
ohos.sensor SensorType SENSOR_TYPE_ID_SIGNIFICANT_MOTION = 264 Added
ohos.sensor SensorType SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED = 263 Added
ohos.sensor SensorType SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED = 261 Added
ohos.sensor SensorType SENSOR_TYPE_ID_AMBIENT_TEMPERATURE = 260 Added
ohos.sensor SensorType SENSOR_TYPE_ID_ROTATION_VECTOR = 259 Added
ohos.sensor SensorType SENSOR_TYPE_ID_LINEAR_ACCELERATION = 258 Added
ohos.sensor SensorType SENSOR_TYPE_ID_GRAVITY = 257 Added
ohos.sensor SensorType SENSOR_TYPE_ID_ORIENTATION = 256 Added
ohos.sensor SensorType SENSOR_TYPE_ID_HUMIDITY = 13 Added
ohos.sensor SensorType SENSOR_TYPE_ID_PROXIMITY = 12 Added
ohos.sensor SensorType SENSOR_TYPE_ID_HALL = 10 Added
ohos.sensor SensorType SENSOR_TYPE_ID_BAROMETER = 8 Added
ohos.sensor SensorType SENSOR_TYPE_ID_MAGNETIC_FIELD = 6 Added
ohos.sensor SensorType SENSOR_TYPE_ID_AMBIENT_LIGHT = 5 Added
ohos.sensor SensorType SENSOR_TYPE_ID_GYROSCOPE = 2 Added
ohos.sensor SensorType SENSOR_TYPE_ID_ACCELEROMETER = 1 Added
ohos.sensor Options interval?: number; Added
ohos.sensor RotationMatrixResponse inclination: Array<number> Added
ohos.sensor RotationMatrixResponse rotation: Array<number>; Added
ohos.sensor sensor getDirection(rotationMatrix: Array<number>, callback: AsyncCallback<Array<number>>): void;
getDirection(rotationMatrix: Array<number>): Promise<Array<number>>;
Added
ohos.sensor sensor createQuaternion(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void;
createQuaternion(rotationVector: Array<number>): Promise<Array<number>>;
Added
ohos.sensor sensor transformCoordinateSystem(inRotationVector: Array<number>, coordinates: CoordinatesOptions, callback: AsyncCallback<Array<number>>): void;
transformCoordinateSystem(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise<Array<number>>;
Added
ohos.sensor CoordinatesOptions y: number; Added
ohos.sensor CoordinatesOptions x: number; Added
ohos.sensor sensor createRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void;
createRotationMatrix(rotationVector: Array<number>): Promise<Array<number>>;
createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>, callback: AsyncCallback<RotationMatrixResponse>): void;
createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>,): Promise<RotationMatrixResponse>;
Added
ohos.sensor sensor getAngleModify(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>, callback: AsyncCallback<Array<number>>): void;
getAngleModify(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise<Array<number>>;
Added
ohos.sensor sensor getGeomagneticDip(inclinationMatrix: Array<number>, callback: AsyncCallback<number>): void;
getGeomagneticDip(inclinationMatrix: Array<number>): Promise<number>;
Added
ohos.sensor sensor getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback<number>): void;
getAltitude(seaPressure: number, currentPressure: number): Promise<number>;
Added
ohos.sensor sensor getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback<GeomagneticResponse>): void;
getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise<GeomagneticResponse>;
Added
ohos.sensor GeomagneticResponse totalIntensity: number; Added
ohos.sensor GeomagneticResponse levelIntensity: number; Added
ohos.sensor GeomagneticResponse deflectionAngle: number; Added
ohos.sensor GeomagneticResponse geomagneticDip: number; Added
ohos.sensor GeomagneticResponse z: number; Added
ohos.sensor GeomagneticResponse y: number; Added
ohos.sensor GeomagneticResponse x: number; Added
ohos.sensor LocationOptions altitude: number; Added
ohos.sensor LocationOptions longitude: number; Added
ohos.sensor LocationOptions latitude: number; Added
ohos.sensor sensor off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback?: Callback<AccelerometerResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback?: Callback<AccelerometerUncalibratedResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback?: Callback<LightResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback?: Callback<AmbientTemperatureResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback?: Callback<BarometerResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback?: Callback<GravityResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback?: Callback<GyroscopeResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback<GyroscopeUncalibratedResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_HALL, callback?: Callback<HallResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback<HeartRateResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback?: Callback<HumidityResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback<LinearAccelerometerResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback?: Callback<MagneticFieldResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback?: Callback<MagneticFieldUncalibratedResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback?: Callback<OrientationResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback?: Callback<PedometerResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback?: Callback<PedometerDetectionResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback?: Callback<ProximityResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback?: Callback<RotationVectorResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback?: Callback<SignificantMotionResponse>): void;
off(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback?: Callback<WearDetectionResponse>): void;
Added
ohos.sensor sensor once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<AccelerometerResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback<LightResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback<BarometerResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback<GravityResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback<GyroscopeResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback<HallResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRateResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback<HumidityResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback<LinearAccelerometerResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback<OrientationResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback<PedometerResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback<ProximityResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback<RotationVectorResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>): void;
once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback<WearDetectionResponse>): void;
Added
ohos.sensor sensor on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<AccelerometerResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback<LightResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback<BarometerResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback<GravityResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback<GyroscopeResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback<HallResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRateResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback<HumidityResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback<LinearAccelerometerResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback<OrientationResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback<PedometerResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback<ProximityResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback<RotationVectorResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>, options?: Options): void;
on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback<WearDetectionResponse>, options?: Options): void;
Added

你可能感兴趣的鸿蒙文章

harmony(鸿蒙)Readme

harmony(鸿蒙)Updates (OpenHarmony 3.1 Beta -> OpenHarmony 3.1 Release)

harmony(鸿蒙)JS API Changes of the Ability Framework

harmony(鸿蒙)JS API Changes of the Accessibility Subsystem

harmony(鸿蒙)JS API Changes of the Account Subsystem

harmony(鸿蒙)JS API Changes of the ArkUI Development Framework

harmony(鸿蒙)JS API Changes of the Power Management Subsystem

harmony(鸿蒙)JS API Changes of the Bundle Management Framework

harmony(鸿蒙)JS API Changes of the Communication Subsystem

harmony(鸿蒙)JS API Changes of the Utils Subsystem

0  赞