1# Battery Vibrator Customization
2
3## Overview
4
5### Introduction
6
7OpenHarmony provides the vibrator customization function for the battery service. Specifically, you can modify the vibrator configuration file of the battery service so that vibration is triggered when a charger is connected to the device.
8
9### Constraints
10
11The device must be equipped with a vibrator.
12
13
14## **How to Develop**
15
16### Setting Up the Environment
17
18- **Hardware requirements:**
19
20  Development board running the standard system, for example, the DAYU200 open source suite, and connected to a vibrator
21
22- **Environment requirements:**
23
24  For details about the requirements on the Linux environment, see [Quick Start](../quick-start/quickstart-overview.md).
25
26### Getting Started with Development
27
28The following uses the RK3568 development board as an example to illustrate battery charging vibration customization.
29
301. Write the custom `battery_vibrator.json` file by referring to the [battery_vibrator.json](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/battery_vibrator.json) file in the default folder of battery vibrator configuration.
31
32    ```text
33    profile
34    ├── BUILD.gn
35    ├── battery_config.json
36    ├── battery_vibrator.json
37    ```
38
39    Example configuration:
40
41    ```json
42    {
43        "start_charge": {
44            "enable": true,
45            "type": "haptic.charging"
46        }
47    }
48    ```
49   - **start_charge**: name of the vibration scenario, which cannot be changed.
50
51   - **enable**: whether to enable vibration. The value **true** indicates that vibration is enabled, and the value **false** indicates the opposite. The default value is **false**.
52
53   - **type**: vibration type. The default value is **haptic.charging** in the current mode.
54
552. Build the customized version by referring to [Quick Start](../quick-start/quickstart-overview.md).
56
57    ```shell
58    ./build.sh --product-name rk3568 --ccache
59    ```
60
613. Burn the customized version to the RK3568 development board.
62
63### Debugging and Verification
64
65Upon device restarting, connect a charger to the device and check whether the device vibrates. If the device vibrates, the customization is successful.
66
67
68## Reference
69
70During development, you can refer to the default battery vibrator configuration:
71
72[Default Battery Vibrator Configuration](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/battery_vibrator.json)
73