From 9c2b2ba47df4f4294053f178b58e7394d0cbc4d6 Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Fri, 26 Aug 2022 06:51:32 +0000 Subject: [PATCH 01/11] add vibrate interce on api9 Signed-off-by: wuzhihuitmac Change-Id: I7dc075d817ec45c927de2d01202ae18b34cf7c68 --- .../reference/apis/js-apis-vibrator.md | 108 +++++++++++++++++- 1 file changed, 106 insertions(+), 2 deletions(-) mode change 100644 => 100755 zh-cn/application-dev/reference/apis/js-apis-vibrator.md diff --git a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md old mode 100644 new mode 100755 index 3e3f5b1c20f..8c834c209ec --- a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md @@ -27,19 +27,20 @@ vibrate(duration: number): Promise<void> **系统能力**:SystemCapability.Sensors.MiscDevice - **参数:** + | 参数名 | 类型 | 必填 | 说明 | | -------- | ------ | ---- | ------------ | | duration | number | 是 | 指示马达振动的持续时间。 | **返回值:** + | 类型 | 说明 | | ------------------- | ----------- | | Promise<void> | 指示触发振动是否成功。 | - **示例:** + ```js vibrator.vibrate(1000).then(()=>{ console.log("Promise returned to indicate a successful vibration."); @@ -48,6 +49,44 @@ vibrate(duration: number): Promise<void> }); ``` +## vibrator.vibrate + +vibrate(effect: VibrateEffect, attribute: VibrateAttribute): Promise<void> + +按照指定振动效果和振动属性触发马达振动。 + +**权限列表**:ohos.permission.VIBRATE,该权限为系统权限 + +**系统能力**:SystemCapability.Sensors.MiscDevice + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ---------------- | ---- | :------------- | +| effect | VibrateEffect | 是 | 马达振动效果。 | +| attribute | VibrateAttribute | 是 | 马达振动属性。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------- | +| Promise<void> | Promise实例。 | + +**示例:** + +```js +vibrator.vibrate({ + 'type': 'time', + 'duration': 1000 +}, { + 'id': 1, + 'usage': 'alarm' +}).then((result)=>{ + console.log("Promise returned to indicate a successful vibration"); +}).catch((error)=>{ + console.log("error.code"+error.code+"error.message"+error.message); +}) +``` ## vibrator.vibrate @@ -124,6 +163,7 @@ vibrate(effectId: EffectId, callback?: AsyncCallback<void>): void | callback | AsyncCallback<void> | 否 | 马达执行振动的回调函数,指示触发振动是否成功。 | **示例:** + ```js vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER, function(error){ if(error){ @@ -134,6 +174,41 @@ vibrate(effectId: EffectId, callback?: AsyncCallback<void>): void }) ``` +## vibrator.vibrate + +vibrate(effect: VibrateEffect, attribute: VibrateAttribute, callback: AsyncCallback<void>): void + +按照指定振动效果和振动属性触发马达振动。 + +**权限列表**:ohos.permission.VIBRATE,该权限为系统权限 + +**系统能力**:SystemCapability.Sensors.MiscDevice + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------- | ---- | :----------------------- | +| effect | VibrateEffect | 是 | 马达振动效果。 | +| attribute | VibrateAttribute | 是 | 马达振动属性。 | +| callback | AsyncCallback<void> | 是 | 指定的callback回调方法。 | + +示例: + +```js +vibrator.vibrate({ + 'type':'time', + 'duration':1000, +},{ + 'id':1, + 'usage': 'alarm' +}, (error)=>{ + if(error){ + console.log(TAG + " fail, error.code:"+error.code+",error.message:"+error.message); + }else{ + console.log("Callback returned to indicate a successful vibration."); + } +}); +``` ## vibrator.stop @@ -214,3 +289,32 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; | ------------------------- | -------- | ---------------------------------------- | | VIBRATOR_STOP_MODE_TIME | "time" | 停止模式为duration模式的振动。即触发振动时参数类型为number,参数本身为指示振动持续时间的触发方式。 | | VIBRATOR_STOP_MODE_PRESET | "preset" | 停止模式为预置EffectId的振动。即触发振动时参数类型为EffectId,参数本身为指示马达振动效果的字符串的触发方式。 | + +## VibrateTime + +表示马达振动时间 + +| 名称 | 默认值 | 说明 | +| -------- | ------ | ------------------------ | +| type | "time" | 指定振动效果类型。 | +| duration | 100 | 指定振动效果的持续时间。 | + +## VibratePreset + +表示马达预置振动类型 + +| 名称 | 默认值 | 说明 | +| -------- | -------------------- | ------------------------------ | +| type | "preset" | 预置振动类型。 | +| effectId | "haptic.clock.timer" | 调整定时器时振动器的振动效果。 | +| count | 1 | 循环振动的次数。 | + +## VibrateAttribute + +表示马达振动属性 + +| 名称 | 默认值 | 说明 | +| ----- | --------- | ------------------------------------------------------------ | +| id | 123 | 振动器id。 | +| usage | "unknown" | 振动的使用。取值范围["unknown" , "alarm" , "ring" , "notification" , "communication" ]。 | + -- Gitee From 5b2660b6bda9290b594464063ca3ca91a98be6d1 Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Fri, 26 Aug 2022 06:58:51 +0000 Subject: [PATCH 02/11] change 755 to 644 Signed-off-by: wuzhihuitmac Change-Id: If3a6c1ed1efea05569bd597cf02099cb7944b713 --- zh-cn/application-dev/reference/apis/js-apis-vibrator.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 zh-cn/application-dev/reference/apis/js-apis-vibrator.md diff --git a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md old mode 100755 new mode 100644 -- Gitee From c0a863ae639d044b12365811f1542efe225f3b10 Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Mon, 29 Aug 2022 03:17:24 +0000 Subject: [PATCH 03/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuzhihuitmac Change-Id: I4247c109e6298600dd42f6725f74986e3dbc5e01 --- .../reference/apis/js-apis-vibrator.md | 174 ++++++++++-------- 1 file changed, 96 insertions(+), 78 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md index 8c834c209ec..364a373b459 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md @@ -23,21 +23,21 @@ vibrate(duration: number): Promise<void> 按照指定持续时间触发马达振动。 -**权限列表**:ohos.permission.VIBRATE,该权限为系统权限 +**需要权限**:ohos.permission.VIBRATE,该权限为系统权限 **系统能力**:SystemCapability.Sensors.MiscDevice **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------ | ---- | ------------ | -| duration | number | 是 | 指示马达振动的持续时间。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ---------------------- | +| duration | number | 是 | 马达振动时长, 单位ms。 | **返回值:** -| 类型 | 说明 | -| ------------------- | ----------- | -| Promise<void> | 指示触发振动是否成功。 | +| 类型 | 说明 | +| ------------------- | ------------- | +| Promise<void> | Promise实例。 | **示例:** @@ -49,13 +49,13 @@ vibrate(duration: number): Promise<void> }); ``` -## vibrator.vibrate +## vibrator.vibrate9+ vibrate(effect: VibrateEffect, attribute: VibrateAttribute): Promise<void> 按照指定振动效果和振动属性触发马达振动。 -**权限列表**:ohos.permission.VIBRATE,该权限为系统权限 +**需要权限**:ohos.permission.VIBRATE,该权限为系统权限 **系统能力**:SystemCapability.Sensors.MiscDevice @@ -76,15 +76,15 @@ vibrate(effect: VibrateEffect, attribute: VibrateAttribute): Promise<void> ```js vibrator.vibrate({ - 'type': 'time', + 'type': 'time', 'duration': 1000 }, { - 'id': 1, - 'usage': 'alarm' + 'id': 0, + 'usage': 'alarm' }).then((result)=>{ - console.log("Promise returned to indicate a successful vibration"); + console.log("Promise returned to indicate a successful vibration"); }).catch((error)=>{ - console.log("error.code"+error.code+"error.message"+error.message); + console.log("error.code"+error.code+"error.message"+error.message); }) ``` @@ -94,17 +94,18 @@ vibrate(duration: number, callback?: AsyncCallback<void>): void 按照指定持续时间触发马达振动。 -**权限列表**:ohos.permission.VIBRATE,该权限为系统权限 +**需要权限**:ohos.permission.VIBRATE,该权限为系统权限 **系统能力**:SystemCapability.Sensors.MiscDevice **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------- | ---- | ----------------------- | -| duration | number | 是 | 指示马达振动的持续时间。 | -| callback | AsyncCallback<void> | 否 | 马达执行振动的回调函数,指示触发振动是否成功。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ------------------------ | +| duration | number | 是 | 马达振动时长, 单位ms。 | +| callback | AsyncCallback<void> | 否 | 指定的callback回调方法。 | **示例:** + ```js vibrator.vibrate(1000,function(error){ if(error){ @@ -120,21 +121,21 @@ vibrate(duration: number, callback?: AsyncCallback<void>): void vibrate(effectId: EffectId): Promise<void> -按照指定振动效果触发马达振动。 +按照预置振动效果触发马达振动。 -**权限列表**:ohos.permission.VIBRATE,该权限为系统权限 +**需要权限**:ohos.permission.VIBRATE,该权限为系统权限 **系统能力**:SystemCapability.Sensors.MiscDevice **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | --------------------- | ---- | ------------- | -| effectId | [EffectId](#effectid) | 是 | 指示马达振动效果的字符串。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ------------------ | +| effectId | [EffectId](#effectid) | 是 | 预置的振动效果ID。 | **返回值:** -| 类型 | 说明 | -| ------------------- | ----------- | -| Promise<void> | 指示触发振动是否成功。 | +| 类型 | 说明 | +| ------------------- | ------------- | +| Promise<void> | Promise实例。 | **示例:** ```js @@ -152,15 +153,15 @@ vibrate(effectId: EffectId, callback?: AsyncCallback<void>): void 按照指定振动效果触发马达振动。 -**权限列表**:ohos.permission.VIBRATE,该权限为系统权限 +**需要权限**:ohos.permission.VIBRATE,该权限为系统权限 **系统能力**:SystemCapability.Sensors.MiscDevice **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------- | ---- | ----------------------- | -| effectId | [EffectId](#effectid) | 是 | 指示马达振动效果的字符串。 | -| callback | AsyncCallback<void> | 否 | 马达执行振动的回调函数,指示触发振动是否成功。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ------------------------ | +| effectId | [EffectId](#effectid) | 是 | 预置的振动效果ID。 | +| callback | AsyncCallback<void> | 否 | 指定的callback回调方法。 | **示例:** @@ -174,13 +175,13 @@ vibrate(effectId: EffectId, callback?: AsyncCallback<void>): void }) ``` -## vibrator.vibrate +## vibrator.vibrate9+ vibrate(effect: VibrateEffect, attribute: VibrateAttribute, callback: AsyncCallback<void>): void 按照指定振动效果和振动属性触发马达振动。 -**权限列表**:ohos.permission.VIBRATE,该权限为系统权限 +**需要权限**:ohos.permission.VIBRATE,该权限为系统权限 **系统能力**:SystemCapability.Sensors.MiscDevice @@ -196,17 +197,17 @@ vibrate(effect: VibrateEffect, attribute: VibrateAttribute, callback: AsyncCallb ```js vibrator.vibrate({ - 'type':'time', + 'type':'time', 'duration':1000, },{ - 'id':1, + 'id':0, 'usage': 'alarm' }, (error)=>{ - if(error){ - console.log(TAG + " fail, error.code:"+error.code+",error.message:"+error.message); + if(error){ + console.log(TAG + " fail, error.code:"+error.code+",error.message:"+error.message); }else{ - console.log("Callback returned to indicate a successful vibration."); - } + console.log("Callback returned to indicate a successful vibration."); + } }); ``` @@ -216,21 +217,23 @@ stop(stopMode: VibratorStopMode): Promise<void> 按照要停止指定的振动模式来停止马达的振动。如果要停止的振动模式与触发马达振动时的模式不相同,则调用本接口会失败。 -**权限列表**:ohos.permission.VIBRATE,该权限为系统权限 +**需要权限**:ohos.permission.VIBRATE,该权限为系统权限 **系统能力**:SystemCapability.Sensors.MiscDevice **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------- | ---- | --------------- | -| stopMode | [VibratorStopMode](#vibratorstopmode) | 是 | 指示马达要停止指定的振动模式。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------- | ---- | ------------------------ | +| stopMode | [VibratorStopMode](#vibratorstopmode) | 是 | 马达停止指定的振动模式。 | **返回值:** -| 类型 | 说明 | -| ------------------- | ----------- | -| Promise<void> | 指示停止振动是否成功。 | + +| 类型 | 说明 | +| ------------------- | ------------- | +| Promise<void> | Promise实例。 | **示例:** + ```js vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then(()=>{ console.log("Promise returned to indicate a successful vibration."); @@ -246,17 +249,18 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; 按照要停止指定的振动模式来停止马达的振动。如果要停止的振动模式与触发马达振动时的模式不相同,则调用本接口会失败。 -**权限列表**:ohos.permission.VIBRATE,该权限为系统权限 +**需要权限**:ohos.permission.VIBRATE,该权限为系统权限 **系统能力**:SystemCapability.Sensors.MiscDevice **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------- | ---- | ----------------------- | -| stopMode | [VibratorStopMode](#vibratorstopmode) | 是 | 指示马达要停止指定的振动模式。 | -| callback | AsyncCallback<void> | 否 | 马达停止振动的回调函数,指示停止振动是否成功。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------- | ---- | ------------------------ | +| stopMode | [VibratorStopMode](#vibratorstopmode) | 是 | 马达停止指定的振动模式。 | +| callback | AsyncCallback<void> | 否 | 指定的callback回调方法。 | **示例:** + ```js vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET, function(error){ if(error){ @@ -270,51 +274,65 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; ## EffectId -表示马达振动效果的字符串。 +马达振动效果的字符串。 **系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.MiscDevice -| 名称 | 默认值 | 说明 | -| ------------------ | -------------------- | --------------- | -| EFFECT_CLOCK_TIMER | "haptic.clock.timer" | 调整定时器时振动器的振动效果。 | +| 名称 | 默认值 | 说明 | +| ------------------ | -------------------- | ------------------ | +| EFFECT_CLOCK_TIMER | "haptic.clock.timer" | 预置的振动效果ID。 | ## VibratorStopMode -表示马达要停止指定的振动模式。 +马达要停止指定的振动模式。 **系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.MiscDevice -| 名称 | 默认值 | 说明 | -| ------------------------- | -------- | ---------------------------------------- | -| VIBRATOR_STOP_MODE_TIME | "time" | 停止模式为duration模式的振动。即触发振动时参数类型为number,参数本身为指示振动持续时间的触发方式。 | -| VIBRATOR_STOP_MODE_PRESET | "preset" | 停止模式为预置EffectId的振动。即触发振动时参数类型为EffectId,参数本身为指示马达振动效果的字符串的触发方式。 | +| 名称 | 默认值 | 说明 | +| ------------------------- | -------- | ------------------------------------------------------------ | +| VIBRATOR_STOP_MODE_TIME | "time" | 停止模式为duration模式的振动。即触发振动时参数类型为number,参数本身为振动持续时间的触发方式。 | +| VIBRATOR_STOP_MODE_PRESET | "preset" | 停止模式为预置EffectId的振动。即触发振动时参数类型为EffectId,参数本身为马达振动效果的字符串的触发方式。 | ## VibrateTime -表示马达振动时间 +马达振动时长。 -| 名称 | 默认值 | 说明 | -| -------- | ------ | ------------------------ | -| type | "time" | 指定振动效果类型。 | -| duration | 100 | 指定振动效果的持续时间。 | +| 名称 | 默认值 | 说明 | +| -------- | ------ | ------------------------------ | +| type | "time" | 按照指定持续时间触发马达振动。 | +| duration | | 马达振动时长, 单位ms。 | ## VibratePreset -表示马达预置振动类型 +马达预置振动类型。 -| 名称 | 默认值 | 说明 | -| -------- | -------------------- | ------------------------------ | -| type | "preset" | 预置振动类型。 | -| effectId | "haptic.clock.timer" | 调整定时器时振动器的振动效果。 | -| count | 1 | 循环振动的次数。 | +| 名称 | 默认值 | 说明 | +| -------- | -------- | ------------------------------ | +| type | "preset" | 按照预置振动效果触发马达振动。 | +| effectId | | 预置的振动效果ID。 | +| count | | 重复振动的次数。 | ## VibrateAttribute -表示马达振动属性 - -| 名称 | 默认值 | 说明 | -| ----- | --------- | ------------------------------------------------------------ | -| id | 123 | 振动器id。 | -| usage | "unknown" | 振动的使用。取值范围["unknown" , "alarm" , "ring" , "notification" , "communication" ]。 | +马达振动属性。 + +| 名称 | 默认值 | 说明 | +| ----- | ------ | -------------- | +| id | 0 | 振动器id。 | +| usage | | 马达振动场景。 | + +## Usage + +| 名称 | 类型 | 说明 | +| ---------------- | ------ | ---------- | +| unknown | string | 未知。 | +| alarm | string | 闹钟。 | +| ring | string | 来电。 | +| notification | string | 通知。 | +| communication | string | 通信。 | +| touch | string | 触摸。 | +| media | string | 多媒体。 | +| physicalFeedback | string | 物理反馈。 | +| simulateReality | string | 虚拟现实。 | -- Gitee From ff71f6938a6725d2ddad257b170ae4e00103f7d9 Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Mon, 29 Aug 2022 04:44:10 +0000 Subject: [PATCH 04/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B6=85=E9=93=BE?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuzhihuitmac Change-Id: I15b83299a503879a64e5c4d5fbc31f72d7c077a4 --- .../reference/apis/js-apis-vibrator.md | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md index 364a373b459..4e85c7d43e6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md @@ -61,10 +61,10 @@ vibrate(effect: VibrateEffect, attribute: VibrateAttribute): Promise<void> **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| --------- | ---------------- | ---- | :------------- | -| effect | VibrateEffect | 是 | 马达振动效果。 | -| attribute | VibrateAttribute | 是 | 马达振动属性。 | +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------- | ---- | :------------- | +| effect | [VibrateEffect](#vibrateeffect) | 是 | 马达振动效果。 | +| attribute | [VibrateAttribute](#vibrateattribute) | 是 | 马达振动属性。 | **返回值:** @@ -187,11 +187,11 @@ vibrate(effect: VibrateEffect, attribute: VibrateAttribute, callback: AsyncCallb **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| --------- | ------------------------- | ---- | :----------------------- | -| effect | VibrateEffect | 是 | 马达振动效果。 | -| attribute | VibrateAttribute | 是 | 马达振动属性。 | -| callback | AsyncCallback<void> | 是 | 指定的callback回调方法。 | +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------- | ---- | :----------------------- | +| effect | [VibrateEffect](#vibrateeffect) | 是 | 马达振动效果。 | +| attribute | [VibrateAttribute](#vibrateattribute) | 是 | 马达振动属性。 | +| callback | AsyncCallback<void> | 是 | 指定的callback回调方法。 | 示例: @@ -294,6 +294,13 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; | VIBRATOR_STOP_MODE_TIME | "time" | 停止模式为duration模式的振动。即触发振动时参数类型为number,参数本身为振动持续时间的触发方式。 | | VIBRATOR_STOP_MODE_PRESET | "preset" | 停止模式为预置EffectId的振动。即触发振动时参数类型为EffectId,参数本身为马达振动效果的字符串的触发方式。 | +## VibrateEffect + +| 名称 | 类型 | 说明 | +| ------------- | ------ | ------------------ | +| VibrateTime | string | 马达振动时长。 | +| VibratePreset | string | 马达预置振动类型。 | + ## VibrateTime 马达振动时长。 -- Gitee From cbfeb3fa5cd885661c5d3f1c3d56c89515605621 Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Mon, 29 Aug 2022 08:49:26 +0000 Subject: [PATCH 05/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuzhihuitmac Change-Id: I7342c4782c9510cc52a810ca286fd70481bc4de8 --- .../reference/apis/js-apis-vibrator.md | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md index 4e85c7d43e6..ef2a0401590 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md @@ -331,15 +331,17 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; ## Usage -| 名称 | 类型 | 说明 | -| ---------------- | ------ | ---------- | -| unknown | string | 未知。 | -| alarm | string | 闹钟。 | -| ring | string | 来电。 | -| notification | string | 通知。 | -| communication | string | 通信。 | -| touch | string | 触摸。 | -| media | string | 多媒体。 | -| physicalFeedback | string | 物理反馈。 | -| simulateReality | string | 虚拟现实。 | +振动使用场景。 + +| 名称 | 类型 | 说明 | +| ---------------- | ------ | ------------------------------ | +| unknown | string | 没有明确使用场景,最低优先级。 | +| alarm | string | 用于警报振动的场景。 | +| ring | string | 用于铃声振动的场景。 | +| notification | string | 用于通知振动的场景。 | +| communication | string | 用于通信振动的场景。 | +| touch | string | 用于触摸振动的场景。 | +| media | string | 用于多媒体振动的场景。 | +| physicalFeedback | string | 用于物理反馈振动的场景。 | +| simulateReality | string | 用于模拟现实振动的场景。 | -- Gitee From dad83db0e74a95e3859dbc426f11c81bf50c9312 Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Tue, 30 Aug 2022 11:20:13 +0000 Subject: [PATCH 06/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuzhihuitmac Change-Id: I7faa31ebdf19c53089075a28fdbd976363c87c27 --- .../reference/apis/js-apis-vibrator.md | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md index ef2a0401590..fddb2b6a110 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md @@ -35,9 +35,9 @@ vibrate(duration: number): Promise<void> **返回值:** -| 类型 | 说明 | -| ------------------- | ------------- | -| Promise<void> | Promise实例。 | +| 类型 | 说明 | +| ------------------- | -------------------------------------- | +| Promise<void> | Promise对象。无返回结果的Promise对象。 | **示例:** @@ -68,9 +68,9 @@ vibrate(effect: VibrateEffect, attribute: VibrateAttribute): Promise<void> **返回值:** -| 类型 | 说明 | -| ------------------- | ------------- | -| Promise<void> | Promise实例。 | +| 类型 | 说明 | +| ------------------- | -------------------------------------- | +| Promise<void> | Promise对象。无返回结果的Promise对象。 | **示例:** @@ -99,10 +99,10 @@ vibrate(duration: number, callback?: AsyncCallback<void>): void **系统能力**:SystemCapability.Sensors.MiscDevice **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------- | ---- | ------------------------ | -| duration | number | 是 | 马达振动时长, 单位ms。 | -| callback | AsyncCallback<void> | 否 | 指定的callback回调方法。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------------------------------------------------------- | +| duration | number | 是 | 马达振动时长, 单位ms。 | +| callback | AsyncCallback<void> | 否 | 回调函数。当马达振动成功,err为undefined,否则为错误对象。 | **示例:** @@ -133,9 +133,9 @@ vibrate(effectId: EffectId): Promise<void> | effectId | [EffectId](#effectid) | 是 | 预置的振动效果ID。 | **返回值:** -| 类型 | 说明 | -| ------------------- | ------------- | -| Promise<void> | Promise实例。 | +| 类型 | 说明 | +| ------------------- | -------------------------------------- | +| Promise<void> | Promise对象。无返回结果的Promise对象。 | **示例:** ```js @@ -158,10 +158,10 @@ vibrate(effectId: EffectId, callback?: AsyncCallback<void>): void **系统能力**:SystemCapability.Sensors.MiscDevice **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------- | ---- | ------------------------ | -| effectId | [EffectId](#effectid) | 是 | 预置的振动效果ID。 | -| callback | AsyncCallback<void> | 否 | 指定的callback回调方法。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------------------------------------------------------- | +| effectId | [EffectId](#effectid) | 是 | 预置的振动效果ID。 | +| callback | AsyncCallback<void> | 否 | 回调函数。当马达振动成功,err为undefined,否则为错误对象。 | **示例:** @@ -187,11 +187,11 @@ vibrate(effect: VibrateEffect, attribute: VibrateAttribute, callback: AsyncCallb **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| --------- | ------------------------------------- | ---- | :----------------------- | -| effect | [VibrateEffect](#vibrateeffect) | 是 | 马达振动效果。 | -| attribute | [VibrateAttribute](#vibrateattribute) | 是 | 马达振动属性。 | -| callback | AsyncCallback<void> | 是 | 指定的callback回调方法。 | +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------- | ---- | :--------------------------------------------------------- | +| effect | [VibrateEffect](#vibrateeffect) | 是 | 马达振动效果。 | +| attribute | [VibrateAttribute](#vibrateattribute) | 是 | 马达振动属性。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当马达振动成功,err为undefined,否则为错误对象。 | 示例: @@ -228,9 +228,9 @@ stop(stopMode: VibratorStopMode): Promise<void> **返回值:** -| 类型 | 说明 | -| ------------------- | ------------- | -| Promise<void> | Promise实例。 | +| 类型 | 说明 | +| ------------------- | -------------------------------------- | +| Promise<void> | Promise对象。无返回结果的Promise对象。 | **示例:** @@ -254,10 +254,10 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; **系统能力**:SystemCapability.Sensors.MiscDevice **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------- | ---- | ------------------------ | -| stopMode | [VibratorStopMode](#vibratorstopmode) | 是 | 马达停止指定的振动模式。 | -| callback | AsyncCallback<void> | 否 | 指定的callback回调方法。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------- | ---- | ------------------------------------------------------------ | +| stopMode | [VibratorStopMode](#vibratorstopmode) | 是 | 马达停止指定的振动模式。 | +| callback | AsyncCallback<void> | 否 | 回调函数。当马达停止振动成功,err为undefined,否则为错误对象。 | **示例:** -- Gitee From 0c9594dccf0d5eb9a0911d8b30031fe072a25ed9 Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Wed, 31 Aug 2022 01:07:34 +0000 Subject: [PATCH 07/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuzhihuitmac Change-Id: I9ecc01b5a83a1f6be2290a7112d01234aeff4bdc --- zh-cn/application-dev/reference/apis/js-apis-vibrator.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md index fddb2b6a110..f6157f60941 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md @@ -1,7 +1,5 @@ # 振动 -## 模块说明 - vibrator模块提供控制马达振动的能力,如通过接口控制马达启动马达振动,停止马达振动等。 小器件是指用于向外传递信号的设备,包括马达和LED灯,本组件对开发者提供控制马达振动和LED灯开关的能力。 -- Gitee From 5a5c64f91b8ca220ff4467b9895eb4bf36381095 Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Wed, 31 Aug 2022 07:46:29 +0000 Subject: [PATCH 08/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuzhihuitmac Change-Id: I91130a1e06c026263f7392619045974acdef4ad7 --- zh-cn/application-dev/reference/apis/js-apis-vibrator.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md index f6157f60941..d395c63c4fe 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md @@ -2,8 +2,6 @@ vibrator模块提供控制马达振动的能力,如通过接口控制马达启动马达振动,停止马达振动等。 -小器件是指用于向外传递信号的设备,包括马达和LED灯,本组件对开发者提供控制马达振动和LED灯开关的能力。 - > **说明:** > > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -- Gitee From 951386978e7fc355d3b35bfb4f23d8dd002048db Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Wed, 31 Aug 2022 09:08:09 +0000 Subject: [PATCH 09/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuzhihuitmac Change-Id: I02f82f98919f86505cb38226e6f94c3e55f73ddf --- zh-cn/application-dev/reference/apis/js-apis-vibrator.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md index d395c63c4fe..bef167dfa36 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md @@ -292,10 +292,10 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; ## VibrateEffect -| 名称 | 类型 | 说明 | -| ------------- | ------ | ------------------ | -| VibrateTime | string | 马达振动时长。 | -| VibratePreset | string | 马达预置振动类型。 | +| 类型 | 说明 | +| ------------- | ------------------ | +| VibrateTime | 马达振动时长。 | +| VibratePreset | 马达预置振动类型。 | ## VibrateTime -- Gitee From 62013839a85d383e36c3744b1428b666adcf58bf Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Wed, 31 Aug 2022 11:09:36 +0000 Subject: [PATCH 10/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuzhihuitmac Change-Id: Ic4d9b8f1539708788a875c46175f37e2c68c3a74 --- .../reference/apis/js-apis-vibrator.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md index bef167dfa36..2799eceada1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md @@ -292,10 +292,10 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; ## VibrateEffect -| 类型 | 说明 | -| ------------- | ------------------ | -| VibrateTime | 马达振动时长。 | -| VibratePreset | 马达预置振动类型。 | +| 类型 | 说明 | +| ------------------------------- | ------------------ | +| [VibrateTime](#vibratetime) | 马达振动时长。 | +| [VibratePreset](#vibratepreset) | 马达预置振动类型。 | ## VibrateTime @@ -304,7 +304,7 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; | 名称 | 默认值 | 说明 | | -------- | ------ | ------------------------------ | | type | "time" | 按照指定持续时间触发马达振动。 | -| duration | | 马达振动时长, 单位ms。 | +| duration | - | 马达振动时长, 单位ms。 | ## VibratePreset @@ -313,8 +313,8 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; | 名称 | 默认值 | 说明 | | -------- | -------- | ------------------------------ | | type | "preset" | 按照预置振动效果触发马达振动。 | -| effectId | | 预置的振动效果ID。 | -| count | | 重复振动的次数。 | +| effectId | - | 预置的振动效果ID。 | +| count | - | 重复振动的次数。 | ## VibrateAttribute @@ -323,7 +323,7 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; | 名称 | 默认值 | 说明 | | ----- | ------ | -------------- | | id | 0 | 振动器id。 | -| usage | | 马达振动场景。 | +| usage | - | 马达振动场景。 | ## Usage -- Gitee From 1a2bc782917014614050f21e6ca15611cc55d272 Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Thu, 1 Sep 2022 02:53:34 +0000 Subject: [PATCH 11/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuzhihuitmac Change-Id: Ib56afe1c8bd67193f62990596a4ee2b32f26fcc3 --- .../reference/apis/js-apis-vibrator.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md index 2799eceada1..3459cfc51a5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md @@ -72,11 +72,11 @@ vibrate(effect: VibrateEffect, attribute: VibrateAttribute): Promise<void> ```js vibrator.vibrate({ - 'type': 'time', - 'duration': 1000 + type: 'time', + duration: 1000 }, { - 'id': 0, - 'usage': 'alarm' + id: 0, + usage: 'alarm' }).then((result)=>{ console.log("Promise returned to indicate a successful vibration"); }).catch((error)=>{ @@ -193,11 +193,11 @@ vibrate(effect: VibrateEffect, attribute: VibrateAttribute, callback: AsyncCallb ```js vibrator.vibrate({ - 'type':'time', - 'duration':1000, + type:'time', + duration:1000, },{ - 'id':0, - 'usage': 'alarm' + id:0, + usage: 'alarm' }, (error)=>{ if(error){ console.log(TAG + " fail, error.code:"+error.code+",error.message:"+error.message); @@ -290,14 +290,14 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; | VIBRATOR_STOP_MODE_TIME | "time" | 停止模式为duration模式的振动。即触发振动时参数类型为number,参数本身为振动持续时间的触发方式。 | | VIBRATOR_STOP_MODE_PRESET | "preset" | 停止模式为预置EffectId的振动。即触发振动时参数类型为EffectId,参数本身为马达振动效果的字符串的触发方式。 | -## VibrateEffect +## VibrateEffect9+ -| 类型 | 说明 | -| ------------------------------- | ------------------ | -| [VibrateTime](#vibratetime) | 马达振动时长。 | -| [VibratePreset](#vibratepreset) | 马达预置振动类型。 | +| 类型 | 说明 | +| ------------------------------- | ------------------------------ | +| [VibrateTime](#vibratetime) | 按照指定持续时间触发马达振动。 | +| [VibratePreset](#vibratepreset) | 按照预置振动类型触发马达振动。 | -## VibrateTime +## VibrateTime9+ 马达振动时长。 @@ -306,7 +306,7 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; | type | "time" | 按照指定持续时间触发马达振动。 | | duration | - | 马达振动时长, 单位ms。 | -## VibratePreset +## VibratePreset9+ 马达预置振动类型。 @@ -316,7 +316,7 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; | effectId | - | 预置的振动效果ID。 | | count | - | 重复振动的次数。 | -## VibrateAttribute +## VibrateAttribute9+ 马达振动属性。 @@ -325,7 +325,7 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void; | id | 0 | 振动器id。 | | usage | - | 马达振动场景。 | -## Usage +## Usage9+ 振动使用场景。 -- Gitee