@@ -78,8 +78,8 @@ This JSON file contains two attributes: **MetaData** and **Channels**.
...
@@ -78,8 +78,8 @@ This JSON file contains two attributes: **MetaData** and **Channels**.
-**Channels** provides information about the vibration channel. It is a JSON array that holds information about each channel. It contains two attributes: **Parameters** and **Pattern**.
-**Channels** provides information about the vibration channel. It is a JSON array that holds information about each channel. It contains two attributes: **Parameters** and **Pattern**.
-**Parameters** provides parameters related to the channel. Under it, **Index** indicates the channel ID. The value is fixed at **1** for a single channel. This parameter is mandatory.
-**Parameters** provides parameters related to the channel. Under it, **Index** indicates the channel ID. The value is fixed at **1** for a single channel. This parameter is mandatory.
-**Pattern** indicates the vibration sequence. It is a JSON array. Under it, **Event** indicates a vibration event, which can be either of the following types:
-**Pattern** indicates the vibration sequence. It is a JSON array. Under it, **Event** indicates a vibration event, which can be either of the following types:
-**transient**: short vibration
-**transient**: short vibration
-**continuous**: long vibration
-**continuous**: long vibration
The table below describes the parameters under **Event**.
The table below describes the parameters under **Event**.
...
@@ -105,170 +105,161 @@ The following requirements must be met:
...
@@ -105,170 +105,161 @@ The following requirements must be met:
2. Start vibration with the specified effect and attribute.
2. Start vibration with the specified effect and attribute.
```js
```ts
importvibratorfrom'@ohos.vibrator';
importvibratorfrom'@ohos.vibrator';
try{
try{
vibrator.startVibration({// To use startVibration, you must configure the ohos.permission.VIBRATE permission.
vibrator.startVibration({// To use startVibration, you must configure the ohos.permission.VIBRATE permission.
Subscribes to changes of the wearing state of a wearable device. If this API is called multiple times for the same application, the last call takes effect.
Subscribes to changes of the wearing state of a wearable device. If this API is called multiple times for the same application, the last call takes effect.
console.error(`Failed to subscription. Code: ${code}, data: ${data}`);
},
},
});
});
```
```
...
@@ -425,7 +426,7 @@ Subscribes to data changes of the device orientation sensor.
...
@@ -425,7 +426,7 @@ Subscribes to data changes of the device orientation sensor.
If this API is called multiple times for the same application, the last call takes effect. However, this API cannot be called multiple times in one click event.
If this API is called multiple times for the same application, the last call takes effect. However, this API cannot be called multiple times in one click event.
@@ -474,7 +475,7 @@ Subscribes to data changes of the gyroscope sensor.
...
@@ -474,7 +475,7 @@ Subscribes to data changes of the gyroscope sensor.
If this API is called multiple times for the same application, the last call takes effect. However, this API cannot be called multiple times in one click event.
If this API is called multiple times for the same application, the last call takes effect. However, this API cannot be called multiple times in one click event.
@@ -489,7 +497,7 @@ Describes the vibration with a preset effect.
...
@@ -489,7 +497,7 @@ Describes the vibration with a preset effect.
## VibrateFromFile<sup>10+</sup>
## VibrateFromFile<sup>10+</sup>
Describes the custom vibration type, which is supported only by certain devices.
Describes the custom vibration type, which is supported only by certain devices. If a device does not support this vibration type, [an error code indicating unsupported device](../errorcodes/errorcode-universal.md) is returned.