diff --git a/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp b/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp index 14268ade65053798fcba149b36a07458650f8eee..c115a98b841ae6225f69e111eb05eb62e6d06ae7 100644 --- a/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp +++ b/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp @@ -448,8 +448,16 @@ bool isSupportEffectSync(::taihe::string_view effectId) // Since these macros are auto-generate, lint will cause false positive. // NOLINTBEGIN TH_EXPORT_CPP_API_stopVibrationByModeSync(stopVibrationByModeSync); +TH_EXPORT_CPP_API_StopVibrationWithCallback_chinast_1(stopVibrationByModeSync); +TH_EXPORT_CPP_API_StopVibrationReturnsPromise_chinast_1(stopVibrationByModeSync); TH_EXPORT_CPP_API_startVibrationSync(startVibrationSync); +TH_EXPORT_CPP_API_StartVibrationWithCallback(startVibrationSync); +TH_EXPORT_CPP_API_StartVibrationReturnsPromise(startVibrationSync); TH_EXPORT_CPP_API_isHdHapticSupported(isHdHapticSupported); TH_EXPORT_CPP_API_stopVibrationSync(stopVibrationSync); +TH_EXPORT_CPP_API_StopVibrationWithCallback(stopVibrationSync); +TH_EXPORT_CPP_API_StopVibrationReturnsPromise(stopVibrationSync); TH_EXPORT_CPP_API_isSupportEffectSync(isSupportEffectSync); +TH_EXPORT_CPP_API_IsSupportEffectWithCallback(isSupportEffectSync); +TH_EXPORT_CPP_API_IsSupportEffectReturnsPromise(isSupportEffectSync); // NOLINTEND diff --git a/frameworks/ets/taihe/idl/ohos.vibrator.taihe b/frameworks/ets/taihe/idl/ohos.vibrator.taihe index bf4e15ca7a20b02640b9644b620e36c49960e7da..b5be28999bc3a450052402b1b51954c0608998e7 100644 --- a/frameworks/ets/taihe/idl/ohos.vibrator.taihe +++ b/frameworks/ets/taihe/idl/ohos.vibrator.taihe @@ -624,9 +624,14 @@ struct HapticFileDescriptor { * @syscap SystemCapability.Sensors.MiscDevice * @since 9 */ -@gen_async("stopVibration") -@gen_promise("stopVibration") function stopVibrationByModeSync(stopMode: VibratorStopMode): void; +@static_overload("stopVibration") +@async +function StopVibrationWithCallback_chinast_1(stopMode: VibratorStopMode): void; +@static_overload("stopVibration") +@promise +function StopVibrationReturnsPromise_chinast_1(stopMode: VibratorStopMode): void; + /** * Trigger vibrator vibration. @@ -659,9 +664,13 @@ function stopVibrationByModeSync(stopMode: VibratorStopMode): void; * @atomicservice * @since 11 */ -@gen_async("startVibration") -@gen_promise("startVibration") function startVibrationSync(effect: VibrateEffect, attribute: VibrateAttribute): void; +@static_overload("startVibration") +@async +function StartVibrationWithCallback(effect: VibrateEffect, attribute: VibrateAttribute): void; +@static_overload("startVibration") +@promise +function StartVibrationReturnsPromise(effect: VibrateEffect, attribute: VibrateAttribute): void; /** * Whether the high-definition haptic is supported. @@ -683,9 +692,13 @@ function isHdHapticSupported(): bool; * @atomicservice * @since 12 */ -@gen_async("stopVibration") -@gen_promise("stopVibration") function stopVibrationSync(): void; +@static_overload("stopVibration") +@async +function StopVibrationWithCallback(): void; +@static_overload("stopVibration") +@promise +function StopVibrationReturnsPromise(): void; /** * Whether the preset vibration effect is supported. @@ -698,6 +711,10 @@ function stopVibrationSync(): void; * @syscap SystemCapability.Sensors.MiscDevice * @since 10 */ -@gen_async("isSupportEffect") -@gen_promise("isSupportEffect") -function isSupportEffectSync(effectId: String): bool; \ No newline at end of file +function isSupportEffectSync(effectId: String): bool; +@static_overload("isSupportEffect") +@async +function IsSupportEffectWithCallback(effectId: String): bool; +@static_overload("isSupportEffect") +@promise +function IsSupportEffectReturnsPromise(effectId: String): bool; \ No newline at end of file diff --git a/frameworks/js/ani/vibrator/ets/@ohos.vibrator.ets b/frameworks/js/ani/vibrator/ets/@ohos.vibrator.ets index 9c7c0ceb655e6fc2a390b1473c06f0c09000a904..c8f34155f36375f3c2bd3266e34fb1b607ed6d4b 100644 --- a/frameworks/js/ani/vibrator/ets/@ohos.vibrator.ets +++ b/frameworks/js/ani/vibrator/ets/@ohos.vibrator.ets @@ -25,7 +25,7 @@ export default namespace vibrator { return 0; } - export function startVibration(effect: VibrateEffect, attribute: VibrateAttribute, callback: AsyncCallback): void { + export function startVibration_chinast_1(effect: VibrateEffect, attribute: VibrateAttribute, callback: AsyncCallback): void { let p1 = taskpool.execute(startVibrationIntSync, effect, attribute); p1.then((e: NullishType)=>{ console.log("in callback startVibration then.") @@ -39,7 +39,7 @@ export default namespace vibrator { }) } - export function startVibration(effect: VibrateEffect, attribute: VibrateAttribute): Promise { + export function startVibration_chinast_2(effect: VibrateEffect, attribute: VibrateAttribute): Promise { let p = new Promise((resolve: (v: undefined) => void, reject: (error: Error) => void) : void => { let p1 = taskpool.execute(startVibrationIntSync, effect, attribute); p1.then((e: NullishType) : void =>{ @@ -54,9 +54,11 @@ export default namespace vibrator { return p; } + overload startVibration { startVibration_chinast_1, startVibration_chinast_2 }; + export native function isSupportEffectInterally(effectId: string): boolean; - export function isSupportEffect(effectId: string, callback: AsyncCallback): void { + export function isSupportEffect_chinast_1(effectId: string, callback: AsyncCallback): void { let p1 = taskpool.execute(isSupportEffectInterally, effectId); p1.then((e: NullishType)=>{ let r = e as boolean; @@ -72,7 +74,7 @@ export default namespace vibrator { }); } - export function isSupportEffect(effectId: string): Promise { + export function isSupportEffect_chinast_2(effectId: string): Promise { let p = new Promise((resolve: (v: boolean) => void, reject: (error: Error) => void) : void => { let p1 = taskpool.execute(isSupportEffectInterally, effectId); p1.then((e: NullishType) : boolean=>{ @@ -88,6 +90,8 @@ export default namespace vibrator { return p; } + overload isSupportEffect { isSupportEffect_chinast_1, isSupportEffect_chinast_2 }; + export type Usage = 'unknown' | 'alarm' | 'ring' | 'notification' | 'communication' | 'touch' | 'media' | 'physicalFeedback' | 'simulateReality';