From 4a74e34e9e9b65dc71182f3dd78456da033339da Mon Sep 17 00:00:00 2001 From: shenpeixing Date: Thu, 4 Sep 2025 19:57:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9sdk=E4=B8=8Etaihe=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=B1=BB=E5=9E=8B=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shenpeixing --- .../ets/taihe/author/src/ohos.sensor.impl.cpp | 257 ++++++----- frameworks/ets/taihe/idl/ohos.sensor.taihe | 411 +++++++++--------- 2 files changed, 345 insertions(+), 323 deletions(-) diff --git a/frameworks/ets/taihe/author/src/ohos.sensor.impl.cpp b/frameworks/ets/taihe/author/src/ohos.sensor.impl.cpp index 13f7cdbf..a4fe92a5 100644 --- a/frameworks/ets/taihe/author/src/ohos.sensor.impl.cpp +++ b/frameworks/ets/taihe/author/src/ohos.sensor.impl.cpp @@ -171,53 +171,71 @@ std::map>> g_onceCallbackInfos; std::map>> g_onCallbackInfos; std::mutex g_sensorTaiheAttrListMutex; -RotationMatrixResponse getRotationMatrixSyncGrav(array_view gravity, array_view geomagnetic) +std::vector transformDoubleToFloat(array_view doubleArray) +{ + std::vector floatArray; + for (size_t i = 0; i < doubleArray.size(); ++i) { + floatArray.push_back(static_cast(doubleArray[i])); + } + return floatArray; +} + +array transformFloatToDouble(std::vector floatArray) +{ + array doubleArray = array::make(floatArray.size()); + for (size_t i = 0; i < floatArray.size(); ++i) { + doubleArray[i] = static_cast(floatArray[i]); + } + return doubleArray; +} + +RotationMatrixResponse getRotationMatrixSyncGrav(array_view gravity, array_view geomagnetic) { std::vector rotation(THREE_DIMENSIONAL_MATRIX_LENGTH); std::vector inclination(THREE_DIMENSIONAL_MATRIX_LENGTH); SensorAlgorithm sensorAlgorithm; - std::vector gravityVector(gravity.begin(), gravity.end()); - std::vector geomagneticVector(geomagnetic.begin(), geomagnetic.end()); + std::vector gravityVector = transformDoubleToFloat(gravity); + std::vector geomagneticVector = transformDoubleToFloat(geomagnetic); int32_t ret = sensorAlgorithm.CreateRotationAndInclination(gravityVector, geomagneticVector, rotation, inclination); ohos::sensor::RotationMatrixResponse rsp = { - .rotation = array::make(THREE_DIMENSIONAL_MATRIX_LENGTH), - .inclination = array::make(THREE_DIMENSIONAL_MATRIX_LENGTH), + .rotation = array::make(THREE_DIMENSIONAL_MATRIX_LENGTH), + .inclination = array::make(THREE_DIMENSIONAL_MATRIX_LENGTH), }; if (ret != OHOS::ERR_OK) { taihe::set_business_error(ret, "Create rotation and inclination matrix fail"); return rsp; } for (int32_t i = 0; i < THREE_DIMENSIONAL_MATRIX_LENGTH; ++i) { - rsp.rotation[i] = rotation[i]; - rsp.inclination[i] = inclination[i]; + rsp.rotation[i] = static_cast(rotation[i]); + rsp.inclination[i] = static_cast(inclination[i]); } return rsp; } -array getOrientationSync(array_view rotationMatrix) +array getOrientationSync(array_view rotationMatrix) { std::vector rotationAngle(ROTATION_VECTOR_LENGTH); SensorAlgorithm sensorAlgorithm; - std::vector rotationMatrixVector(rotationMatrix.begin(), rotationMatrix.end()); + std::vector rotationMatrixVector = transformDoubleToFloat(rotationMatrix); int32_t ret = sensorAlgorithm.GetDirection(rotationMatrixVector, rotationAngle); if (ret != OHOS::ERR_OK) { taihe::set_business_error(ret, "Get direction fail"); - return taihe::array(rotationAngle); + return transformFloatToDouble(rotationAngle); } - return taihe::array(rotationAngle); + return transformFloatToDouble(rotationAngle); } -array getRotationMatrixSync(array_view rotation) +array getRotationMatrixSync(array_view rotation) { std::vector rotationMatrix(THREE_DIMENSIONAL_MATRIX_LENGTH); SensorAlgorithm sensorAlgorithm; - std::vector rotationVector(rotation.begin(), rotation.end()); + std::vector rotationVector = transformDoubleToFloat(rotation); int32_t ret = sensorAlgorithm.CreateRotationMatrix(rotationVector, rotationMatrix); if (ret != OHOS::ERR_OK) { taihe::set_business_error(ret, "Create rotation matrix fail"); - return taihe::array(rotationMatrix); + return transformFloatToDouble(rotationMatrix); } - return taihe::array(rotationMatrix); + return transformFloatToDouble(rotationMatrix); } array getSensorListSync() @@ -292,13 +310,13 @@ void CallBackAccelermeter(std::map data, sptr(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; AccelerometerResponse responseData = { .base = res, - .x = std::get(data["x"]), - .y = std::get(data["y"]), - .z = std::get(data["z"]), + .x = std::get(data["x"]), + .y = std::get(data["y"]), + .z = std::get(data["z"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -316,13 +334,13 @@ void CallBackGyroscope(std::map data, sptr(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; GyroscopeResponse responseData = { .base = res, - .x = std::get(data["x"]), - .y = std::get(data["y"]), - .z = std::get(data["z"]), + .x = std::get(data["x"]), + .y = std::get(data["y"]), + .z = std::get(data["z"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -340,13 +358,13 @@ void CallBackAmbientLight(std::map data, sptr(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; LightResponse responseData = { .base = res, - .intensity = std::get(data["intensity"]), - .colorTemperature = taihe::optional(std::in_place_t{}, std::get(data["colorTemperature"])), - .infraredLuminance = taihe::optional(std::in_place_t{}, std::get(data["infraredLuminance"])), + .intensity = std::get(data["intensity"]), + .colorTemperature = taihe::optional(std::in_place_t{}, std::get(data["colorTemperature"])), + .infraredLuminance = taihe::optional(std::in_place_t{}, std::get(data["infraredLuminance"])), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -364,13 +382,13 @@ void CallBackMagneticField(std::map data, sptr< } ohos::sensor::Response res = { .timestamp = std::get(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; MagneticFieldResponse responseData = { .base = res, - .x = std::get(data["x"]), - .y = std::get(data["y"]), - .z = std::get(data["z"]), + .x = std::get(data["x"]), + .y = std::get(data["y"]), + .z = std::get(data["z"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -388,11 +406,11 @@ void CallBackBarometer(std::map data, sptr(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; BarometerResponse responseData = { .base = res, - .pressure = std::get(data["pressure"]), + .pressure = std::get(data["pressure"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -410,11 +428,11 @@ void CallBackHall(std::map data, sptr(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; HallResponse responseData = { .base = res, - .status = std::get(data["status"]), + .status = std::get(data["status"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -432,11 +450,11 @@ void CallBackProximity(std::map data, sptr(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; ProximityResponse responseData = { .base = res, - .distance = std::get(data["distance"]), + .distance = std::get(data["distance"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -454,11 +472,11 @@ void CallBackHumidity(std::map data, sptr(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; HumidityResponse responseData = { .base = res, - .humidity = std::get(data["humidity"]), + .humidity = std::get(data["humidity"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -476,13 +494,13 @@ void CallBackOrientation(std::map data, sptr(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; OrientationResponse responseData = { .base = res, - .alpha = std::get(data["alpha"]), - .beta = std::get(data["beta"]), - .gamma = std::get(data["gamma"]), + .alpha = std::get(data["alpha"]), + .beta = std::get(data["beta"]), + .gamma = std::get(data["gamma"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -500,13 +518,13 @@ void CallBackGravity(std::map data, sptr(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; GravityResponse responseData = { .base = res, - .x = std::get(data["x"]), - .y = std::get(data["y"]), - .z = std::get(data["z"]), + .x = std::get(data["x"]), + .y = std::get(data["y"]), + .z = std::get(data["z"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -524,13 +542,13 @@ void CallBackLinearAcceleration(std::map data, } ohos::sensor::Response res = { .timestamp = std::get(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; LinearAccelerometerResponse responseData = { .base = res, - .x = std::get(data["x"]), - .y = std::get(data["y"]), - .z = std::get(data["z"]), + .x = std::get(data["x"]), + .y = std::get(data["y"]), + .z = std::get(data["z"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -548,14 +566,14 @@ void CallBackRotationVector(std::map data, sptr } ohos::sensor::Response res = { .timestamp = std::get(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; RotationVectorResponse responseData = { .base = res, - .x = std::get(data["x"]), - .y = std::get(data["y"]), - .z = std::get(data["z"]), - .w = std::get(data["w"]), + .x = std::get(data["x"]), + .y = std::get(data["y"]), + .z = std::get(data["z"]), + .w = std::get(data["w"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -573,11 +591,11 @@ void CallBackAmbientTemperature(std::map data, } ohos::sensor::Response res = { .timestamp = std::get(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; AmbientTemperatureResponse responseData = { .base = res, - .temperature = std::get(data["temperature"]), + .temperature = std::get(data["temperature"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -597,16 +615,16 @@ void CallBackMagneticFieldUncalibrated(std::map } ohos::sensor::Response res = { .timestamp = std::get(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; MagneticFieldUncalibratedResponse responseData = { .base = res, - .x = std::get(data["x"]), - .y = std::get(data["y"]), - .z = std::get(data["z"]), - .biasX = std::get(data["biasX"]), - .biasY = std::get(data["biasY"]), - .biasZ = std::get(data["biasZ"]), + .x = std::get(data["x"]), + .y = std::get(data["y"]), + .z = std::get(data["z"]), + .biasX = std::get(data["biasX"]), + .biasY = std::get(data["biasY"]), + .biasZ = std::get(data["biasZ"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -625,16 +643,16 @@ void CallBackGyroscopeUncalibrated(std::map dat } ohos::sensor::Response res = { .timestamp = std::get(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; GyroscopeUncalibratedResponse responseData = { .base = res, - .x = std::get(data["x"]), - .y = std::get(data["y"]), - .z = std::get(data["z"]), - .biasX = std::get(data["biasX"]), - .biasY = std::get(data["biasY"]), - .biasZ = std::get(data["biasZ"]), + .x = std::get(data["x"]), + .y = std::get(data["y"]), + .z = std::get(data["z"]), + .biasX = std::get(data["biasX"]), + .biasY = std::get(data["biasY"]), + .biasZ = std::get(data["biasZ"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -652,11 +670,11 @@ void CallBackSignificantMotion(std::map data, s } ohos::sensor::Response res = { .timestamp = std::get(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; SignificantMotionResponse responseData = { .base = res, - .scalar = std::get(data["scalar"]), + .scalar = std::get(data["scalar"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -674,11 +692,11 @@ void CallBackPedometerDetection(std::map data, } ohos::sensor::Response res = { .timestamp = std::get(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; PedometerDetectionResponse responseData = { .base = res, - .scalar = std::get(data["scalar"]), + .scalar = std::get(data["scalar"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -696,11 +714,11 @@ void CallBackPedometer(std::map data, sptr(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; PedometerResponse responseData = { .base = res, - .steps = std::get(data["steps"]), + .steps = std::get(data["steps"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -718,11 +736,11 @@ void CallBackHeartRate(std::map data, sptr(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; HeartRateResponse responseData = { .base = res, - .heartRate = std::get(data["heartRate"]), + .heartRate = std::get(data["heartRate"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -740,11 +758,11 @@ void CallBackWearDetection(std::map data, sptr< } ohos::sensor::Response res = { .timestamp = std::get(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; WearDetectionResponse responseData = { .base = res, - .value = std::get(data["value"]), + .value = std::get(data["value"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -764,16 +782,16 @@ void CallBackAccelerometerUncalibrated(std::map } ohos::sensor::Response res = { .timestamp = std::get(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; AccelerometerUncalibratedResponse responseData = { .base = res, - .x = std::get(data["x"]), - .y = std::get(data["y"]), - .z = std::get(data["z"]), - .biasX = std::get(data["biasX"]), - .biasY = std::get(data["biasY"]), - .biasZ = std::get(data["biasZ"]), + .x = std::get(data["x"]), + .y = std::get(data["y"]), + .z = std::get(data["z"]), + .biasX = std::get(data["biasX"]), + .biasY = std::get(data["biasY"]), + .biasZ = std::get(data["biasZ"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -791,12 +809,12 @@ void CallBackColor(std::map data, sptr(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; ColorResponse responseData = { .base = res, - .lightIntensity = std::get(data["lightIntensity"]), - .colorTemperature = std::get(data["colorTemperature"]), + .lightIntensity = std::get(data["lightIntensity"]), + .colorTemperature = std::get(data["colorTemperature"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -814,11 +832,11 @@ void CallBackSar(std::map data, sptr(data["timestamp"]), - .accuracy = std::get(data["accuracy"]), + .accuracy = std::get(data["accuracy"]), }; SarResponse responseData = { .base = res, - .absorptionRatio = std::get(data["absorptionRatio"]), + .absorptionRatio = std::get(data["absorptionRatio"]), }; auto &func = std::get>(callbackObject->callback); func(responseData); @@ -857,11 +875,10 @@ void CallbackSensorData(sptr callbackObject, SensorEvent *event) } std::map dataMap; for (size_t i = 0; i < size; ++i) { - dataMap.emplace(sensorAttributes[i].c_str(), static_cast(dataNow[i])); + dataMap.emplace(sensorAttributes[i].c_str(), static_cast(dataNow[i])); } dataMap.emplace("timestamp", event->timestamp); - ohos::sensor::SensorAccuracy sensorAccuracyTemp(static_cast(event->option)); - dataMap.emplace("accuracy", sensorAccuracyTemp); + dataMap.emplace("accuracy", event->option); CallbackDataBySensorTypeId(sensorTypeId, dataMap, callbackObject); } @@ -1142,7 +1159,7 @@ void OffCommon(int32_t sensorTypeId, optional_view opq) } } -void OffWearDetection(optional_view opq) +void OffWearDetection(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_WEAR_DETECTION, opq); } @@ -1158,7 +1175,7 @@ void OnceSignificantMotion(callback_view opq) +void OffSignificantMotion(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_SIGNIFICANT_MOTION, opq); } @@ -1174,7 +1191,7 @@ void OnceRotationVector(callback_view f, u OnceCommon(SENSOR_TYPE_ID_ROTATION_VECTOR, f, opq); } -void OffRotationVector(optional_view opq) +void OffRotationVector(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_ROTATION_VECTOR, opq); } @@ -1189,7 +1206,7 @@ void OnceProximity(callback_view f, uintptr_t o OnceCommon(SENSOR_TYPE_ID_PROXIMITY, f, opq); } -void OffProximity(optional_view opq) +void OffProximity(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_PROXIMITY, opq); } @@ -1205,7 +1222,7 @@ void OncePedometerDetection(callback_view opq) +void OffPedometerDetection(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_PEDOMETER_DETECTION, opq); } @@ -1220,7 +1237,7 @@ void OncePedometer(callback_view f, uintptr_t o OnceCommon(SENSOR_TYPE_ID_PEDOMETER, f, opq); } -void OffPedometer(optional_view opq) +void OffPedometer(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_PEDOMETER, opq); } @@ -1235,7 +1252,7 @@ void OnceOrientation(callback_view f, uintptr OnceCommon(SENSOR_TYPE_ID_ORIENTATION, f, opq); } -void OffOrientation(optional_view opq) +void OffOrientation(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_ORIENTATION, opq); } @@ -1251,7 +1268,7 @@ void OnceMagneticFieldUncalibrated(callback_view opq) +void OffMagneticFieldUncalibrated(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, opq); } @@ -1267,7 +1284,7 @@ void OnceMagneticField(callback_view f, uin OnceCommon(SENSOR_TYPE_ID_MAGNETIC_FIELD, f, opq); } -void OffMagneticField(optional_view opq) +void OffMagneticField(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_MAGNETIC_FIELD, opq); } @@ -1283,7 +1300,7 @@ void OnceLinearAccelerometer(callback_view opq) +void OffLinearAccelerometer(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_LINEAR_ACCELERATION, opq); } @@ -1298,7 +1315,7 @@ void OnceHumidity(callback_view f, uintptr_t opq OnceCommon(SENSOR_TYPE_ID_HUMIDITY, f, opq); } -void OffHumidity(optional_view opq) +void OffHumidity(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_HUMIDITY, opq); } @@ -1313,7 +1330,7 @@ void OnceHeartRate(callback_view f, uintptr_t o OnceCommon(SENSOR_TYPE_ID_HEART_RATE, f, opq); } -void OffHeartRate(optional_view opq) +void OffHeartRate(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_HEART_RATE, opq); } @@ -1328,7 +1345,7 @@ void OnceHall(callback_view f, uintptr_t opq) OnceCommon(SENSOR_TYPE_ID_HALL, f, opq); } -void OffHall(optional_view opq) +void OffHall(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_HALL, opq); } @@ -1344,7 +1361,7 @@ void OnceGyroscopeUncalibrated(callback_view opq) +void OffGyroscopeUncalibrated(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, opq); } @@ -1359,7 +1376,7 @@ void OnceGyroscope(callback_view f, uintptr_t o OnceCommon(SENSOR_TYPE_ID_GYROSCOPE, f, opq); } -void OffGyroscope(optional_view opq) +void OffGyroscope(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_GYROSCOPE, opq); } @@ -1374,7 +1391,7 @@ void OnceGravity(callback_view f, uintptr_t opq) OnceCommon(SENSOR_TYPE_ID_GRAVITY, f, opq); } -void OffGravity(optional_view opq) +void OffGravity(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_GRAVITY, opq); } @@ -1389,7 +1406,7 @@ void OnceBarometer(callback_view f, uintptr_t o OnceCommon(SENSOR_TYPE_ID_BAROMETER, f, opq); } -void OffBarometer(optional_view opq) +void OffBarometer(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_BAROMETER, opq); } @@ -1405,7 +1422,7 @@ void OnceAmbientTemperature(callback_view opq) +void OffAmbientTemperature(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, opq); } @@ -1420,7 +1437,7 @@ void OnceAmbientLight(callback_view f, uintptr_t op OnceCommon(SENSOR_TYPE_ID_AMBIENT_LIGHT, f, opq); } -void OffAmbientLight(optional_view opq) +void OffAmbientLight(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_AMBIENT_LIGHT, opq); } @@ -1436,7 +1453,7 @@ void OnceAccelerometerUncalibrated(callback_view opq) +void OffAccelerometerUncalibrated(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, opq); } @@ -1452,7 +1469,7 @@ void OnceAccelerometer(callback_view f, uin OnceCommon(SENSOR_TYPE_ID_ACCELEROMETER, f, opq); } -void OffAccelerometer(optional_view opq) +void OffAccelerometer(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_ACCELEROMETER, opq); } @@ -1462,7 +1479,7 @@ void OnSar(callback_view f, uintptr_t opq, optional_v OnCommon(SENSOR_TYPE_ID_SAR, f, opq, options); } -void OffSar(optional_view opq) +void OffSar(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_SAR, opq); } @@ -1472,7 +1489,7 @@ void OnColor(callback_view f, uintptr_t opq, option OnCommon(SENSOR_TYPE_ID_COLOR, f, opq, options); } -void OffColor(optional_view opq) +void OffColor(optional_view sensorInfoParam, optional_view opq) { OffCommon(SENSOR_TYPE_ID_COLOR, opq); } diff --git a/frameworks/ets/taihe/idl/ohos.sensor.taihe b/frameworks/ets/taihe/idl/ohos.sensor.taihe index 7681850a..73636ea4 100644 --- a/frameworks/ets/taihe/idl/ohos.sensor.taihe +++ b/frameworks/ets/taihe/idl/ohos.sensor.taihe @@ -287,12 +287,12 @@ struct Response { /** * The accuracy levels of data reported by a sensor. - * @type { SensorAccuracy } + * @type { i32 } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since 11 */ - accuracy: SensorAccuracy; + accuracy: i32; } /** @@ -314,48 +314,48 @@ struct AccelerometerResponse { /** * Acceleration x-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ /** * Acceleration x-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since 11 */ - x: f32; + x: f64; /** * Acceleration y-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ /** * Acceleration y-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since 11 */ - y: f32; + y: f64; /** * Acceleration z-axis component - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ /** * Acceleration z-axis component - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since 11 */ - z: f32; + z: f64; } /** @@ -370,27 +370,27 @@ struct LinearAccelerometerResponse { /** * Linear acceleration x-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - x: f32; + x: f64; /** * Linear acceleration y-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - y: f32; + y: f64; /** * Linear acceleration z-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - z: f32; + z: f64; } /** @@ -405,54 +405,54 @@ struct AccelerometerUncalibratedResponse { /** * Acceleration uncalibrated x-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - x: f32; + x: f64; /** * Acceleration uncalibrated y-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - y: f32; + y: f64; /** * Acceleration uncalibrated z-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - z: f32; + z: f64; /** * Acceleration uncalibrated x-axis offset. * - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - biasX: f32; + biasX: f64; /** * Acceleration uncalibrated y-axis offset. * - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - biasY: f32; + biasY: f64; /** * Acceleration uncalibrated z-axis offset. * - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - biasZ: f32; + biasZ: f64; } /** @@ -467,27 +467,27 @@ struct GravityResponse { /** * Gravity x-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - x: f32; + x: f64; /** * Gravity y-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - y: f32; + y: f64; /** * Gravity z-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - z: f32; + z: f64; } /** @@ -509,48 +509,48 @@ struct OrientationResponse { /** * The device rotates at an angle around the Z axis. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ /** * The device rotates at an angle around the Z axis. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since 11 */ - alpha: f32; + alpha: f64; /** * The device rotates at an angle around the X axis. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ /** * The device rotates at an angle around the X axis. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since 11 */ - beta: f32; + beta: f64; /** * The device rotates at an angle around the Y axis. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ /** * The device rotates at an angle around the Y axis. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since 11 */ - gamma: f32; + gamma: f64; } /** @@ -565,35 +565,35 @@ struct RotationVectorResponse { /** * Rotation vector x-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - x: f32; + x: f64; /** * Rotation vector y-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - y: f32; + y: f64; /** * Rotation vector z-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - z: f32; + z: f64; /** * Scalar quantity. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - w: f32; + w: f64; } /** @@ -615,48 +615,48 @@ struct GyroscopeResponse { /** * Gyroscope x-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ /** * Gyroscope x-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since 11 */ - x: f32; + x: f64; /** * Gyroscope y-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ /** * Gyroscope y-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since 11 */ - y: f32; + y: f64; /** * Gyroscope z-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ /** * Gyroscope z-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since 11 */ - z: f32; + z: f64; } /** @@ -671,51 +671,51 @@ struct GyroscopeUncalibratedResponse { /** * Gyroscope uncalibrated x-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - x: f32; + x: f64; /** * Gyroscope uncalibrated y-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - y: f32; + y: f64; /** * Gyroscope uncalibrated z-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - z: f32; + z: f64; /** * Gyroscope uncalibrated x-axis offset. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - biasX: f32; + biasX: f64; /** * Gyroscope uncalibrated y-axis offset. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - biasY: f32; + biasY: f64; /** * Gyroscope uncalibrated z-axis offset. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - biasZ: f32; + biasZ: f64; } /** @@ -732,11 +732,11 @@ struct SignificantMotionResponse { * The degree of significant motion. * Whether the device has a significant motion. * The value 1 means that the device has a significant motion, and 0 means the opposite. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - scalar: f32; + scalar: f64; } /** @@ -751,11 +751,11 @@ struct ProximityResponse { /** * Indicates the degree of proximity, event 0 indicates proximity, and greater than 0 indicates distance. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - distance: f32; + distance: f64; } /** @@ -770,27 +770,27 @@ struct LightResponse { /** * Indicates light intensity, in lux. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - intensity: f32; + intensity: f64; /** * Indicates color temperature, in kelvin. - * @type { ?f32 } + * @type { ?f64 } * @syscap SystemCapability.Sensors.Sensor * @since 12 */ - colorTemperature: Optional; + colorTemperature: Optional; /** * Indicates infrared luminance, in cd/m2. - * @type { ?f32 } + * @type { ?f64 } * @syscap SystemCapability.Sensors.Sensor * @since 12 */ - infraredLuminance: Optional; + infraredLuminance: Optional; } /** @@ -805,11 +805,11 @@ struct HallResponse { /** * Indicates hall status, 0 indicates open, and greater than 0 indicates suction. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - status: f32; + status: f64; } /** @@ -824,27 +824,27 @@ struct MagneticFieldResponse { /** * Magnetic field x-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - x: f32; + x: f64; /** * Magnetic field y-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - y: f32; + y: f64; /** * Magnetic field z-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - z: f32; + z: f64; } /** @@ -859,51 +859,51 @@ struct MagneticFieldUncalibratedResponse { /** * Magnetic field uncalibrated x-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - x: f32; + x: f64; /** * Magnetic field uncalibrated y-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - y: f32; + y: f64; /** * Magnetic field uncalibrated z-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - z: f32; + z: f64; /** * Magnetic field uncalibrated x-axis offset. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - biasX: f32; + biasX: f64; /** * Magnetic field uncalibrated y-axis offset. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - biasY: f32; + biasY: f64; /** * Magnetic field uncalibrated z-axis offset. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - biasZ: f32; + biasZ: f64; } /** @@ -918,11 +918,11 @@ struct PedometerResponse { /** * Indicates the number of steps. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - steps: f32; + steps: f64; } /** @@ -938,11 +938,11 @@ struct PedometerDetectionResponse { /** * Indicates the pedometer detection status, 1 indicates that a walking action has occurred, * and 0 indicates that no movement has occurred. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - scalar: f32; + scalar: f64; } /** @@ -957,11 +957,11 @@ struct HeartRateResponse { /** * Indicates the number of heart rate. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - heartRate: f32; + heartRate: f64; } /** @@ -976,11 +976,11 @@ struct BarometerResponse { /** * Indicates the number of barometer, in hpa. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - pressure: f32; + pressure: f64; } /** @@ -995,11 +995,11 @@ struct WearDetectionResponse { /** * Indicates the status of wear detection, 1 for wearing, 0 for wearing not. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - value: f32; + value: f64; } /** @@ -1014,11 +1014,11 @@ struct HumidityResponse { /** * Indicates the number of humidity. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - humidity: f32; + humidity: f64; } /** @@ -1033,11 +1033,11 @@ struct AmbientTemperatureResponse { /** * Indicates ambient temperature, in celsius. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - temperature: f32; + temperature: f64; } /** @@ -1053,12 +1053,12 @@ struct SarResponse { /** * Indicates the specific absorption rate, in W/kg. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @systemapi * @since 10 */ - absorptionRatio: f32; + absorptionRatio: f64; } /** @@ -1074,20 +1074,20 @@ struct ColorResponse { /** * Indicates the intensity of light, in lux. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @systemapi * @since 10 */ - lightIntensity: f32; + lightIntensity: f64; /** * Indicates the color temperature, in kelvin. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @systemapi * @since 10 */ - colorTemperature: f32; + colorTemperature: f64; } /** @@ -1099,19 +1099,19 @@ struct ColorResponse { struct RotationMatrixResponse { /** * rotation matrix. - * @type { Array } + * @type { Array } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - rotation: Array; + rotation: Array; /** * inclination matrix. - * @type { Array } + * @type { Array } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - inclination: Array; + inclination: Array; } /** @@ -1145,59 +1145,59 @@ struct CoordinatesOptions { struct GeomagneticResponse { /** * Geomagnetic x-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - x: f32; + x: f64; /** * Geomagnetic y-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - y: f32; + y: f64; /** * Geomagnetic z-axis component. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - z: f32; + z: f64; /** * The Angle between the earth's magnetic field lines and the horizontal plane. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - geomagneticDip: f32; + geomagneticDip: f64; /** * The Angle of magnetic north and true north on a horizontal plane. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - deflectionAngle: f32; + deflectionAngle: f64; /** * The horizontal strength of the geomagnetic field. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - levelIntensity: f32; + levelIntensity: f64; /** * The total strength of the geomagnetic field. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 8 */ - totalIntensity: f32; + totalIntensity: f64; } /** @@ -1249,11 +1249,11 @@ struct Sensor { /** * Maximum measurement range of the sensor. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 9 */ - maxRange: f32; + maxRange: f64; /** * Minimum sample period allowed, in ns. @@ -1273,19 +1273,19 @@ struct Sensor { /** * Sensor accuracy. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 9 */ - precision: f32; + precision: f64; /** * Sensor power. - * @type { f32 } + * @type { f64 } * @syscap SystemCapability.Sensors.Sensor * @since 9 */ - power: f32; + power: f64; } /** @@ -1334,10 +1334,15 @@ struct Options { interval: MapOption; } +struct SensorInfoParam { + deviceId: Optional; + sensorIndex: Optional; + } + /** * Calculate rotation matrix based on gravity vector and geomagnetic vector. - * @param { Array } gravity - gravity Indicates the gravity vector. - * @param { Array } geomagnetic - geomagnetic Indicates the geomagnetic vector. + * @param { Array } gravity - gravity Indicates the gravity vector. + * @param { Array } geomagnetic - geomagnetic Indicates the geomagnetic vector. * @param { AsyncCallback } callback - callback rotation matrix and inclination matrix. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types; 3. Parameter verification failed. @@ -1347,12 +1352,12 @@ struct Options { */ @gen_async("getRotationMatrix") @gen_promise("getRotationMatrix") -function getRotationMatrixSyncGrav(gravity: Array, geomagnetic: Array): RotationMatrixResponse; +function getRotationMatrixSyncGrav(gravity: Array, geomagnetic: Array): RotationMatrixResponse; /** * Computes the device's orientation based on the rotation matrix. - * @param { Array } rotationMatrix - rotationMatrix Indicates the rotation matrix. - * @param { AsyncCallback> } callback - callback the angle of rotation around the z, x, y axis. + * @param { Array } rotationMatrix - rotationMatrix Indicates the rotation matrix. + * @param { AsyncCallback> } callback - callback the angle of rotation around the z, x, y axis. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 14500101 - Service exception. @@ -1361,12 +1366,12 @@ function getRotationMatrixSyncGrav(gravity: Array, geomagnetic: Array) */ @gen_async("getOrientation") @gen_promise("getOrientation") -function getOrientationSync(rotationMatrix: Array): Array; +function getOrientationSync(rotationMatrix: Array): Array; /** * Convert rotation vector to rotation matrix. - * @param { Array } rotationVector - rotationVector Indicates the rotation vector. - * @param { AsyncCallback> } callback - callback rotation matrix. + * @param { Array } rotationVector - rotationVector Indicates the rotation vector. + * @param { AsyncCallback> } callback - callback rotation matrix. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 14500101 - Service exception. @@ -1375,7 +1380,7 @@ function getOrientationSync(rotationMatrix: Array): Array; */ @gen_async("getRotationMatrix") @gen_promise("getRotationMatrix") -function getRotationMatrixSync(rotationVector: Array): Array; +function getRotationMatrixSync(rotationVector: Array): Array; /** * Obtains all sensor information on the device. @@ -1445,121 +1450,121 @@ function getSensorListSync(): Array; default: throw new Error(`Unknown type: ${type}`); } } - function off(type: string, callback?: (arg0 : Object) => void) { + function off(type: string, sensorInfoParam?: SensorInfoParam, callback?: (arg0 : Object) => void) { switch(type) { - case "wearDetectionChange": return offWearDetection(callback); - case "significantMotionChange": return offSignificantMotion(callback); - case "rotationVectorChange": return offRotationVector(callback); - case "proximityChange": return offProximity(callback); - case "pedometerDetectionChange": return offPedometerDetection(callback); - case "pedometerChange": return offPedometer(callback); - case "orientationChange": return offOrientation(callback); - case "magneticFieldUncalibratedChange": return offMagneticFieldUncalibrated(callback); - case "magneticFieldChange": return offMagneticField(callback); - case "linearAccelerometerChange": return offLinearAccelerometer(callback); - case "humidityChange": return offHumidity(callback); - case "heartRateChange": return offHeartRate(callback); - case "hallChange": return offHall(callback); - case "gyroscopeUncalibratedChange": return offGyroscopeUncalibrated(callback); - case "gyroscopeChange": return offGyroscope(callback); - case "gravityChange": return offGravity(callback); - case "barometerChange": return offBarometer(callback); - case "ambientTemperatureChange": return offAmbientTemperature(callback); - case "ambientLightChange": return offAmbientLight(callback); - case "accelerometerUncalibratedChange": return offAccelerometerUncalibrated(callback); - case "accelerometerChange": return offAccelerometer(callback); - case "sarChange": return offSar(callback); - case "colorChange": return offColor(callback); + case "wearDetectionChange": return offWearDetection(sensorInfoParam, callback); + case "significantMotionChange": return offSignificantMotion(sensorInfoParam, callback); + case "rotationVectorChange": return offRotationVector(sensorInfoParam, callback); + case "proximityChange": return offProximity(sensorInfoParam, callback); + case "pedometerDetectionChange": return offPedometerDetection(sensorInfoParam, callback); + case "pedometerChange": return offPedometer(sensorInfoParam, callback); + case "orientationChange": return offOrientation(sensorInfoParam, callback); + case "magneticFieldUncalibratedChange": return offMagneticFieldUncalibrated(sensorInfoParam, callback); + case "magneticFieldChange": return offMagneticField(sensorInfoParam, callback); + case "linearAccelerometerChange": return offLinearAccelerometer(sensorInfoParam, callback); + case "humidityChange": return offHumidity(sensorInfoParam, callback); + case "heartRateChange": return offHeartRate(sensorInfoParam, callback); + case "hallChange": return offHall(sensorInfoParam, callback); + case "gyroscopeUncalibratedChange": return offGyroscopeUncalibrated(sensorInfoParam, callback); + case "gyroscopeChange": return offGyroscope(sensorInfoParam, callback); + case "gravityChange": return offGravity(sensorInfoParam, callback); + case "barometerChange": return offBarometer(sensorInfoParam, callback); + case "ambientTemperatureChange": return offAmbientTemperature(sensorInfoParam, callback); + case "ambientLightChange": return offAmbientLight(sensorInfoParam, callback); + case "accelerometerUncalibratedChange": return offAccelerometerUncalibrated(sensorInfoParam, callback); + case "accelerometerChange": return offAccelerometer(sensorInfoParam, callback); + case "sarChange": return offSar(sensorInfoParam, callback); + case "colorChange": return offColor(sensorInfoParam, callback); default: throw new Error(`Unknown type: ${type}`); } } """) function OnWearDetection(f: (info: WearDetectionResponse) => void, opq: Opaque, options: Optional); function OnceWearDetection(f: (info: WearDetectionResponse) => void, opq: Opaque); -function OffWearDetection(opq: Optional); +function OffWearDetection(sensorInfoParam: Optional, opq: Optional); function OnSignificantMotion(f: (info: SignificantMotionResponse) => void, opq: Opaque, options: Optional); function OnceSignificantMotion(f: (info: SignificantMotionResponse) => void, opq: Opaque); -function OffSignificantMotion(opq: Optional); +function OffSignificantMotion(sensorInfoParam: Optional, opq: Optional); function OnRotationVector(f: (info: RotationVectorResponse) => void, opq: Opaque, options: Optional); function OnceRotationVector(f: (info: RotationVectorResponse) => void, opq: Opaque); -function OffRotationVector(opq: Optional); +function OffRotationVector(sensorInfoParam: Optional, opq: Optional); function OnProximity(f: (info: ProximityResponse) => void, opq: Opaque, options: Optional); function OnceProximity(f: (info: ProximityResponse) => void, opq: Opaque); -function OffProximity(opq: Optional); +function OffProximity(sensorInfoParam: Optional, opq: Optional); function OnPedometerDetection(f: (info: PedometerDetectionResponse) => void, opq: Opaque, options: Optional); function OncePedometerDetection(f: (info: PedometerDetectionResponse) => void, opq: Opaque); -function OffPedometerDetection(opq: Optional); +function OffPedometerDetection(sensorInfoParam: Optional, opq: Optional); function OnPedometer(f: (info: PedometerResponse) => void, opq: Opaque, options: Optional); function OncePedometer(f: (info: PedometerResponse) => void, opq: Opaque); -function OffPedometer(opq: Optional); +function OffPedometer(sensorInfoParam: Optional, opq: Optional); function OnOrientation(f: (info: OrientationResponse) => void, opq: Opaque, options: Optional); function OnceOrientation(f: (info: OrientationResponse) => void, opq: Opaque); -function OffOrientation(opq: Optional); +function OffOrientation(sensorInfoParam: Optional, opq: Optional); function OnMagneticFieldUncalibrated(f: (info: MagneticFieldUncalibratedResponse) => void, opq: Opaque, options: Optional); function OnceMagneticFieldUncalibrated(f: (info: MagneticFieldUncalibratedResponse) => void, opq: Opaque); -function OffMagneticFieldUncalibrated(opq: Optional); +function OffMagneticFieldUncalibrated(sensorInfoParam: Optional, opq: Optional); function OnMagneticField(f: (info: MagneticFieldResponse) => void, opq: Opaque, options: Optional); function OnceMagneticField(f: (info: MagneticFieldResponse) => void, opq: Opaque); -function OffMagneticField(opq: Optional); +function OffMagneticField(sensorInfoParam: Optional, opq: Optional); function OnLinearAccelerometer(f: (info: LinearAccelerometerResponse) => void, opq: Opaque, options: Optional); function OnceLinearAccelerometer(f: (info: LinearAccelerometerResponse) => void, opq: Opaque); -function OffLinearAccelerometer(opq: Optional); +function OffLinearAccelerometer(sensorInfoParam: Optional, opq: Optional); function OnHumidity(f: (info: HumidityResponse) => void, opq: Opaque, options: Optional); function OnceHumidity(f: (info: HumidityResponse) => void, opq: Opaque); -function OffHumidity(opq: Optional); +function OffHumidity(sensorInfoParam: Optional, opq: Optional); function OnHeartRate(f: (info: HeartRateResponse) => void, opq: Opaque, options: Optional); function OnceHeartRate(f: (info: HeartRateResponse) => void, opq: Opaque); -function OffHeartRate(opq: Optional); +function OffHeartRate(sensorInfoParam: Optional, opq: Optional); function OnHall(f: (info: HallResponse) => void, opq: Opaque, options: Optional); function OnceHall(f: (info: HallResponse) => void, opq: Opaque); -function OffHall(opq: Optional); +function OffHall(sensorInfoParam: Optional, opq: Optional); function OnGyroscopeUncalibrated(f: (info: GyroscopeUncalibratedResponse) => void, opq: Opaque, options: Optional); function OnceGyroscopeUncalibrated(f: (info: GyroscopeUncalibratedResponse) => void, opq: Opaque); -function OffGyroscopeUncalibrated(opq: Optional); +function OffGyroscopeUncalibrated(sensorInfoParam: Optional, opq: Optional); function OnGyroscope(f: (info: GyroscopeResponse) => void, opq: Opaque, options: Optional); function OnceGyroscope(f: (info: GyroscopeResponse) => void, opq: Opaque); -function OffGyroscope(opq: Optional); +function OffGyroscope(sensorInfoParam: Optional, opq: Optional); function OnGravity(f: (info: GravityResponse) => void, opq: Opaque, options: Optional); function OnceGravity(f: (info: GravityResponse) => void, opq: Opaque); -function OffGravity(opq: Optional); +function OffGravity(sensorInfoParam: Optional, opq: Optional); function OnBarometer(f: (info: BarometerResponse) => void, opq: Opaque, options: Optional); function OnceBarometer(f: (info: BarometerResponse) => void, opq: Opaque); -function OffBarometer(opq: Optional); +function OffBarometer(sensorInfoParam: Optional, opq: Optional); function OnAmbientTemperature(f: (info: AmbientTemperatureResponse) => void, opq: Opaque, options: Optional); function OnceAmbientTemperature(f: (info: AmbientTemperatureResponse) => void, opq: Opaque); -function OffAmbientTemperature(opq: Optional); +function OffAmbientTemperature(sensorInfoParam: Optional, opq: Optional); function OnAmbientLight(f: (info: LightResponse) => void, opq: Opaque, options: Optional); function OnceAmbientLight(f: (info: LightResponse) => void, opq: Opaque); -function OffAmbientLight(opq: Optional); +function OffAmbientLight(sensorInfoParam: Optional, opq: Optional); function OnAccelerometerUncalibrated(f: (info: AccelerometerUncalibratedResponse) => void, opq: Opaque, options: Optional); function OnceAccelerometerUncalibrated(f: (info: AccelerometerUncalibratedResponse) => void, opq: Opaque); -function OffAccelerometerUncalibrated(opq: Optional); +function OffAccelerometerUncalibrated(sensorInfoParam: Optional, opq: Optional); function OnAccelerometer(f: (info: AccelerometerResponse) => void, opq: Opaque, options: Optional); function OnceAccelerometer(f: (info: AccelerometerResponse) => void, opq: Opaque); -function OffAccelerometer(opq: Optional); +function OffAccelerometer(sensorInfoParam: Optional, opq: Optional); function OnSar(f: (info: SarResponse) => void, opq: Opaque, options: Optional); -function OffSar(opq: Optional); +function OffSar(sensorInfoParam: Optional, opq: Optional); function OnColor(f: (info: ColorResponse) => void, opq: Opaque, options: Optional); -function OffColor(opq: Optional); \ No newline at end of file +function OffColor(sensorInfoParam: Optional, opq: Optional); \ No newline at end of file -- Gitee