From e1e3c7571c17ea0e2cbd77523f496a85c2ac06f3 Mon Sep 17 00:00:00 2001 From: lixiangpeng5 Date: Wed, 17 Apr 2024 13:41:45 +0000 Subject: [PATCH 1/4] add parameters for ambient light response Signed-off-by: lixiangpeng5 Change-Id: Iddf3a819939f14ad8687ea95d5008d6308b25174 --- sensors/sensor/oh_sensor_type.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sensors/sensor/oh_sensor_type.h b/sensors/sensor/oh_sensor_type.h index 51c232af6..655bf9539 100644 --- a/sensors/sensor/oh_sensor_type.h +++ b/sensors/sensor/oh_sensor_type.h @@ -314,7 +314,8 @@ int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy *a * the x, y, and z axes of the device, respectively, in m/s2. * SENSOR_TYPE_GYROSCOPE: data[0], data[1], and data[2], indicating the angular velocity of rotation around * the x, y, and z axes of the device, respectively, in rad/s. - * SENSOR_TYPE_AMBIENT_LIGHT: data[0], indicating the ambient light intensity, in lux. + * SENSOR_TYPE_AMBIENT_LIGHT: data[0], indicating the ambient light intensity, in lux; data[1], indicating + * the color temperature, in kelvin; data[2], indicating the infrared Luminance, in cd/m2. * SENSOR_TYPE_MAGNETIC_FIELD: data[0], data[1], and data[2], indicating the magnetic field strength around * the x, y, and z axes of the device, respectively, in μT. * SENSOR_TYPE_BAROMETER: data[0], indicating the atmospheric pressure, in hPa. -- Gitee From 24f47df328fb0d929cc7dbf0c813e39d6fb4e6bd Mon Sep 17 00:00:00 2001 From: lixiangpeng5 Date: Sat, 20 Apr 2024 08:38:21 +0000 Subject: [PATCH 2/4] fix by check Signed-off-by: lixiangpeng5 Change-Id: I74b700a133b342850517b7561943e747119683fb --- sensors/sensor/oh_sensor_type.h | 35 ++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/sensors/sensor/oh_sensor_type.h b/sensors/sensor/oh_sensor_type.h index 655bf9539..fd0564b91 100644 --- a/sensors/sensor/oh_sensor_type.h +++ b/sensors/sensor/oh_sensor_type.h @@ -307,6 +307,39 @@ int32_t OH_SensorEvent_GetTimestamp(Sensor_Event* sensorEvent, int64_t *timestam */ int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy *accuracy); +/** + * @brief Obtains sensor data. The data length and content depend on the sensor type. + * The format of the sensor data reported is as follows: + * SENSOR_TYPE_ACCELEROMETER: data[0], data[1], and data[2], indicating the acceleration around + * the x, y, and z axes of the device, respectively, in m/s2. + * SENSOR_TYPE_GYROSCOPE: data[0], data[1], and data[2], indicating the angular velocity of rotation around + * the x, y, and z axes of the device, respectively, in rad/s. + * SENSOR_TYPE_AMBIENT_LIGHT: data[0], indicating the ambient light intensity, in lux. + * SENSOR_TYPE_MAGNETIC_FIELD: data[0], data[1], and data[2], indicating the magnetic field strength around + * the x, y, and z axes of the device, respectively, in μT. + * SENSOR_TYPE_BAROMETER: data[0], indicating the atmospheric pressure, in hPa. + * SENSOR_TYPE_HALL: data[0], indicating the opening/closing state of the flip cover. The value 0 means that + * the flip cover is opened, and a value greater than 0 means that the flip cover is closed. + * SENSOR_TYPE_PROXIMITY: data[0], indicates the approaching state. The value 0 means the two objects are close + * to each other, and a value greater than 0 means that they are far away from each other. + * SENSOR_TYPE_ORIENTATION: data[0], data[1], and data[2], indicating the rotation angles of a device around + * the z, x, and y axes, respectively, in degree. + * SENSOR_TYPE_GRAVITY: data[0], data[1], and data[2], indicating the gravitational acceleration around + * the x, y, and z axes of a device, respectively, in m/s2. + * SENSOR_TYPE_ROTATION_VECTOR: data[0], data[1] and data[2], indicating the rotation angles of a device around + * the x, y, and z axes, respectively, in degree. data[3] indicates the rotation vector. + * SENSOR_TYPE_PEDOMETER_DETECTION: data[0], indicating the pedometer detection status. + * The value 1 means that the number of detected steps changes. + * SENSOR_TYPE_PEDOMETER: data[0], indicating the number of steps a user has walked. + * SENSOR_TYPE_HEART_RATE: data[0], indicating the heart rate value. + * + * @param sensorEvent - Pointer to the sensor data information. + * @param data - Double pointer to the sensor data. + * @param length - Pointer to the array length. + * @return Returns SENSOR_SUCCESS if the operation is successful; + * returns an error code defined in {@link Sensor_Result} otherwise. + * @since 11 + */ /** * @brief Obtains sensor data. The data length and content depend on the sensor type. * The format of the sensor data reported is as follows: @@ -339,7 +372,7 @@ int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy *a * @param length - Pointer to the array length. * @return Returns SENSOR_SUCCESS if the operation is successful; * returns an error code defined in {@link Sensor_Result} otherwise. - * @since 11 + * @since 12 */ int32_t OH_SensorEvent_GetData(Sensor_Event* sensorEvent, float **data, uint32_t *length); -- Gitee From 6fe13171150eb57dfe2c6de24ee64afb8da9ba85 Mon Sep 17 00:00:00 2001 From: lixiangpeng5 Date: Mon, 22 Apr 2024 12:23:39 +0000 Subject: [PATCH 3/4] fix by check Signed-off-by: lixiangpeng5 Change-Id: I01ecbf496ee503b6daa2f615e88eaf9e600cc6f3 --- sensors/sensor/oh_sensor_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sensors/sensor/oh_sensor_type.h b/sensors/sensor/oh_sensor_type.h index fd0564b91..c7e4e7624 100644 --- a/sensors/sensor/oh_sensor_type.h +++ b/sensors/sensor/oh_sensor_type.h @@ -348,7 +348,7 @@ int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy *a * SENSOR_TYPE_GYROSCOPE: data[0], data[1], and data[2], indicating the angular velocity of rotation around * the x, y, and z axes of the device, respectively, in rad/s. * SENSOR_TYPE_AMBIENT_LIGHT: data[0], indicating the ambient light intensity, in lux; data[1], indicating - * the color temperature, in kelvin; data[2], indicating the infrared Luminance, in cd/m2. + * the color temperature, in kelvin; data[2], indicating the infrared luminance, in cd/m2. * SENSOR_TYPE_MAGNETIC_FIELD: data[0], data[1], and data[2], indicating the magnetic field strength around * the x, y, and z axes of the device, respectively, in μT. * SENSOR_TYPE_BAROMETER: data[0], indicating the atmospheric pressure, in hPa. -- Gitee From 685b9cdba806ea3c7f27870bc814730dca88cd58 Mon Sep 17 00:00:00 2001 From: lixiangpeng5 Date: Thu, 25 Apr 2024 12:35:03 +0000 Subject: [PATCH 4/4] fix by review Signed-off-by: lixiangpeng5 Change-Id: I0fb36a12f16cc6c5263956ebcea7d8f843e55c6a --- sensors/sensor/oh_sensor_type.h | 38 +++------------------------------ 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/sensors/sensor/oh_sensor_type.h b/sensors/sensor/oh_sensor_type.h index c7e4e7624..545acd83e 100644 --- a/sensors/sensor/oh_sensor_type.h +++ b/sensors/sensor/oh_sensor_type.h @@ -314,7 +314,9 @@ int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy *a * the x, y, and z axes of the device, respectively, in m/s2. * SENSOR_TYPE_GYROSCOPE: data[0], data[1], and data[2], indicating the angular velocity of rotation around * the x, y, and z axes of the device, respectively, in rad/s. - * SENSOR_TYPE_AMBIENT_LIGHT: data[0], indicating the ambient light intensity, in lux. + * SENSOR_TYPE_AMBIENT_LIGHT: data[0], indicating the ambient light intensity, in lux. Since api version 12, + * two additional data will be returned, where data[1] indicating the color temperature, in kelvin; data[2] + * indicating the infrared luminance, in cd/m2. * SENSOR_TYPE_MAGNETIC_FIELD: data[0], data[1], and data[2], indicating the magnetic field strength around * the x, y, and z axes of the device, respectively, in μT. * SENSOR_TYPE_BAROMETER: data[0], indicating the atmospheric pressure, in hPa. @@ -340,40 +342,6 @@ int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy *a * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -/** - * @brief Obtains sensor data. The data length and content depend on the sensor type. - * The format of the sensor data reported is as follows: - * SENSOR_TYPE_ACCELEROMETER: data[0], data[1], and data[2], indicating the acceleration around - * the x, y, and z axes of the device, respectively, in m/s2. - * SENSOR_TYPE_GYROSCOPE: data[0], data[1], and data[2], indicating the angular velocity of rotation around - * the x, y, and z axes of the device, respectively, in rad/s. - * SENSOR_TYPE_AMBIENT_LIGHT: data[0], indicating the ambient light intensity, in lux; data[1], indicating - * the color temperature, in kelvin; data[2], indicating the infrared luminance, in cd/m2. - * SENSOR_TYPE_MAGNETIC_FIELD: data[0], data[1], and data[2], indicating the magnetic field strength around - * the x, y, and z axes of the device, respectively, in μT. - * SENSOR_TYPE_BAROMETER: data[0], indicating the atmospheric pressure, in hPa. - * SENSOR_TYPE_HALL: data[0], indicating the opening/closing state of the flip cover. The value 0 means that - * the flip cover is opened, and a value greater than 0 means that the flip cover is closed. - * SENSOR_TYPE_PROXIMITY: data[0], indicates the approaching state. The value 0 means the two objects are close - * to each other, and a value greater than 0 means that they are far away from each other. - * SENSOR_TYPE_ORIENTATION: data[0], data[1], and data[2], indicating the rotation angles of a device around - * the z, x, and y axes, respectively, in degree. - * SENSOR_TYPE_GRAVITY: data[0], data[1], and data[2], indicating the gravitational acceleration around - * the x, y, and z axes of a device, respectively, in m/s2. - * SENSOR_TYPE_ROTATION_VECTOR: data[0], data[1] and data[2], indicating the rotation angles of a device around - * the x, y, and z axes, respectively, in degree. data[3] indicates the rotation vector. - * SENSOR_TYPE_PEDOMETER_DETECTION: data[0], indicating the pedometer detection status. - * The value 1 means that the number of detected steps changes. - * SENSOR_TYPE_PEDOMETER: data[0], indicating the number of steps a user has walked. - * SENSOR_TYPE_HEART_RATE: data[0], indicating the heart rate value. - * - * @param sensorEvent - Pointer to the sensor data information. - * @param data - Double pointer to the sensor data. - * @param length - Pointer to the array length. - * @return Returns SENSOR_SUCCESS if the operation is successful; - * returns an error code defined in {@link Sensor_Result} otherwise. - * @since 12 - */ int32_t OH_SensorEvent_GetData(Sensor_Event* sensorEvent, float **data, uint32_t *length); /** -- Gitee