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