diff --git a/zh-cn/application-dev/device/vibrator-guidelines.md b/zh-cn/application-dev/device/vibrator-guidelines.md
index 8e3b36af9cef3a6bee7f77d7ad87b423bc7e5fd2..0e523ec504de6808314611e054093c611947c6de 100644
--- a/zh-cn/application-dev/device/vibrator-guidelines.md
+++ b/zh-cn/application-dev/device/vibrator-guidelines.md
@@ -226,46 +226,43 @@ try {
```ts
import vibrator from '@ohos.vibrator';
-const FILE_NAME = "xxx.json";
-
// 获取振动文件资源描述符
-let fileDescriptor = undefined;
-getContext().resourceManager.getRawFd(FILE_NAME).then(value => {
- fileDescriptor = { fd: value.fd, offset: value.offset, length: value.length };
- console.info('Succeed in getting resource file descriptor');
-}).catch(error => {
- console.error(`Failed to get resource file descriptor. Code: ${error.code}, message: ${error.message}`);
-});
-// 使用startVibration、stopVibration需要添加ohos.permission.VIBRATE权限
-try {
- // 启动自定义振动
- vibrator.startVibration({
- type: "file",
- hapticFd: { fd: fileDescriptor.fd, offset: fileDescriptor.offset, length: fileDescriptor.length }
- }, {
- usage: "alarm"
- }).then(() => {
- console.info('Succeed in starting vibration');
- }, (error) => {
- console.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`);
- });
- // 停止所有类型的马达振动
- vibrator.stopVibration(function (error) {
- if (error) {
- console.error(`Failed to stop vibration. Code: ${error.code}, message: ${error.message}`);
- return;
- }
- console.info('Succeed in stopping vibration');
- })
-} catch (error) {
- console.error(`An unexpected error occurred. Code: ${error.code}, message: ${error.message}`);
+async function getRawfileFd(fileName) {
+ let rawFd = await globalThis.getContext().resourceManager.getRawFd(fileName);
+ return rawFd;
+}
+
+// 关闭振动文件资源描述符
+async function closeRawfileFd(fileName) {
+ await globalThis.getContext().resourceManager.closeRawFd(fileName)
+}
+
+// 播放自定义振动,使用startVibration、stopVibration需要添加ohos.permission.VIBRATE权限
+async function playCustomHaptic(fileName) {
+ try {
+ let rawFd = await getRawfileFd(fileName);
+ vibrator.startVibration({
+ type: "file",
+ hapticFd: { fd: rawFd.fd, offset: rawFd.offset, length: rawFd.length }
+ }, {
+ usage: "alarm"
+ }).then(() => {
+ console.info('Succeed in starting vibration');
+ }, (error) => {
+ console.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`);
+ });
+ vibrator.stopVibration(function (error) {
+ if (error) {
+ console.error(`Failed to stop vibration. Code: ${error.code}, message: ${error.message}`);
+ return;
+ }
+ console.info('Succeed in stopping vibration');
+ })
+ await closeRawfileFd(fileName);
+ } catch (error) {
+ console.error(`An unexpected error occurred. Code: ${error.code}, message: ${error.message}`);
+ }
}
-// 关闭振动文件资源
-getContext().resourceManager.closeRawFd(FILE_NAME).then(() => {
- console.info('Succeed in closing resource file descriptor');
-}).catch(error => {
- console.error(`Failed to close resource file descriptor. Code: ${error.code}, message: ${error.message}`);
-});
```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-sensor.md b/zh-cn/application-dev/reference/apis/js-apis-sensor.md
index 4b123db84ead1e9ef0ec2dad2e8b89703af4eac8..38b1468069227adff9e4e40308b5cf7dfaad10ac 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-sensor.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-sensor.md
@@ -3387,7 +3387,7 @@ try {
console.info('Succeeded in getting rotationMatrix' + JSON.stringify(data));
})
} catch (error) {
-、 console.error(`Failed to get rotationMatrix. Code: ${error.code}, message: ${error.message}`);
+ console.error(`Failed to get rotationMatrix. Code: ${error.code}, message: ${error.message}`);
}
```
@@ -3612,6 +3612,8 @@ try {
| HALL | 10 | 霍尔传感器。 |
| PROXIMITY | 12 | 接近光传感器。 |
| HUMIDITY | 13 | 湿度传感器。 |
+| COLOR10+ | 14 | 颜色传感器。 |
+| SAR10+ | 15 | 吸收比率传感器。 |
| ORIENTATION | 256 | 方向传感器。 |
| GRAVITY | 257 | 重力传感器。 |
| LINEAR_ACCELEROMETER | 258 | 线性加速度传感器。 |
diff --git a/zh-cn/application-dev/reference/syscap-list.md b/zh-cn/application-dev/reference/syscap-list.md
index 4cffe31aa66f446268aa9aa5ea4347fd0229a2fe..96114aed2a0101109345bafa0ba040e6f56e12e7 100644
--- a/zh-cn/application-dev/reference/syscap-list.md
+++ b/zh-cn/application-dev/reference/syscap-list.md
@@ -1169,7 +1169,7 @@ usb服务
## SystemCapability.Sensors.Sensor.Lite
-传感器服务订阅
+轻量级传感器服务订阅
| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router |
| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ |
@@ -1185,7 +1185,7 @@ usb服务
## SystemCapability.Sensors.MiscDevice.Lite
-小器件-振感
+轻量级小器件-振感
| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router |
| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ |