From bbf711f0ba0c23ceba593c615360d058bc27e3e7 Mon Sep 17 00:00:00 2001 From: shenpeixing Date: Thu, 14 Aug 2025 20:52:26 +0800 Subject: [PATCH] =?UTF-8?q?miscdevice=E6=9C=8D=E5=8A=A1=E4=BF=AE=E6=94=B9t?= =?UTF-8?q?aihe=E6=96=87=E4=BB=B6=E7=B1=BB=E5=9E=8B=E4=B8=BA=E5=AE=9E?= =?UTF-8?q?=E9=99=85=E4=BD=BF=E7=94=A8=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shenpeixing --- .../ets/taihe/author/src/ohos.vibrator.impl.cpp | 7 ++++--- frameworks/ets/taihe/idl/ohos.vibrator.taihe | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp b/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp index ebb2d56..8d294e9 100644 --- a/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp +++ b/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp @@ -86,7 +86,8 @@ static bool ParseVibratorCurvePoint(::taihe::array<::ohos::vibrator::VibratorCur { CALL_LOG_ENTER; point.time = pointsArray[index].time; - point.intensity = pointsArray[index].intensity.has_value() ? pointsArray[index].intensity.value() : 0; + point.intensity = + pointsArray[index].intensity.has_value() ? static_cast(pointsArray[index].intensity.value()) : 0; point.frequency = pointsArray[index].frequency.has_value() ? pointsArray[index].frequency.value() : 0; return true; } @@ -197,7 +198,7 @@ static void PrintVibratorPattern(::ohos::vibrator::VibratorPattern &vibratorPatt ::taihe::array<::ohos::vibrator::VibratorCurvePoint> point = vibratorPattern.events[i].points.value(); for (int32_t j = 0; j < static_cast(vibratorPattern.events[i].points.value().size()); ++j) { MISC_HILOGD("PrintVibratorPattern, time:%{public}d, intensity:%{public}d, frequency:%{public}d", - point[j].time, point[j].intensity.value(), point[j].frequency.value()); + point[j].time, static_cast(point[j].intensity.value()), point[j].frequency.value()); } } } @@ -218,7 +219,7 @@ static bool CheckVibratorCurvePoint(const ::ohos::vibrator::VibratorEvent &event if ((event.points.value()[j].intensity.value() < 0) || (event.points.value()[j].intensity.value() > CURVE_POINT_INTENSITY_MAX)) { MISC_HILOGE("intensity in points is out of range, intensity:%{public}d", - event.points.value()[j].intensity.value()); + static_cast(event.points.value()[j].intensity.value())); return false; } if ((event.points.value()[j].frequency.value() < CURVE_FREQUENCY_MIN) || diff --git a/frameworks/ets/taihe/idl/ohos.vibrator.taihe b/frameworks/ets/taihe/idl/ohos.vibrator.taihe index ebc9189..226df2b 100644 --- a/frameworks/ets/taihe/idl/ohos.vibrator.taihe +++ b/frameworks/ets/taihe/idl/ohos.vibrator.taihe @@ -412,11 +412,11 @@ struct VibratorCurvePoint { /** * Gain in relative event vibration intensity * - * @type { Optional } + * @type { Optional } * @syscap SystemCapability.Sensors.MiscDevice * @since 18 */ - intensity: Optional; + intensity: Optional; /** * Changes in relative event vibration frequency * @@ -595,21 +595,21 @@ struct HapticFileDescriptor { * The offset into the file where the data to be read, in bytes. By default, * the offset is zero. * - * @type { Optional } + * @type { Optional } * @syscap SystemCapability.Sensors.MiscDevice * @since 10 */ - offset: Optional; + offset: Optional; /** * The length in bytes of the data to be read. By default, the length is the * rest of bytes in the file from the offset. * - * @type { Optional } + * @type { Optional } * @syscap SystemCapability.Sensors.MiscDevice * @since 10 */ - length: Optional; + length: Optional; } /** -- Gitee