introduction
This article describes how to install HAP on the BearPi-HM_Micro_small development board.
reference:
https://gitee.com/bearpi/bearpi-hm_micro_small/blob/master/applications/BearPi/BearPi-HM_Micro/docs/device-dev/%E5%A6%82%E4%BD%95%E5%9C%A8%E5%BC%80%E5%8F%91%E6%9D%BF%E4%B8%8A%E5%AE%89%E8%A3%85HAP%E5%BA%94%E7%94%A8.md
1. Preparation
1. Development board: BearPi-HM_Micro_small development board, OpenHarmony 3.0.
Reference: "Building a Pure Ubuntu Development Environment for BearPi-HM_Micro_Small"
2. A TF card and a card reader.
2. Installation steps
hap_tools
1. Prepare a TF card and a card reader, format the TF card into FAT32 format, create a new folder in the TF card , and create a new folder hap_tools
under the folder .hap_example
2. Copy the hap tool bm in the Bear Pi Hongmeng project folder: applications/BearPi/BearPi-HM_Micro/tools/hap_tools to /hap_tools of the TF card.
For how to use the HAP tool bm, you can refer to the official documentation:
https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%8C%85%E7%AE%A1%E7%90%86%E5%AD%90%E7%B3%BB%E7%BB%9F.md
3. Copy the HAP package to be installed (for example: xxx.hap) to the /hap_tools/hap_example folder in the TF card.
4. Insert the TF card into the development board, and then power on the development board.
5. Under Windows, use a terminal tool (such as: MobaXterm tool) to establish a connection with the development board through the serial port. You can also use the terminal tool Monitor of DevEco Device Tool.
6. Execute the command in the terminal: ls /dev
to check whether the system has detected the TF card.
7. Enter the following command in the terminal: mount /dev/mmcblk0p0 /sdcard vfat
, mount the TF card to the /sdcard directory.
8. Enter the directory where the HAP tool bm is located:cd sdcard/hap_tools
9. Close the signature:./bm set -s disable
10. Turn on debug mode:./bm set -d enable
11. Install the application:./bm install -p hap_example/xxx.hap
If you want to uninstall the application, execute the following command:
./bm uninstall -n com.bearpi.ledcontrol
After uninstalling, restart the development board. Here com.bearpi.ledcontrol
is the package name (bunduleName) of the hap to be uninstalled, which can be viewed in the config.json file of the application project, as shown in the following figure: