1 2 3## 使用说明文档 4 5 本文档主要介绍了蓝牙专项测试程序的所在仓,如何使用DevEco程序导入该项目,如何预览、编译和烧录该程序以及该程序的功能使用说明。 6 7### 安装使用说明(win环境) 8 9#### 下载代码 10 111. 文件代码所在仓的地址 12 13[communication_bluetooth: 蓝牙服务组件为设备提供接入与使用Bluetooth的相关接口,包括BLE设备gatt相关的操作,以及BLE广播、扫描等功能。 (gitee.com)](https://gitee.com/openharmony/communication_bluetooth) 14 152. 下载方式 16 17 18 19- 使用git下载 20 21 - 安装git。 22 23 - 选择一个空文件夹,右键打开git Bash。(文件夹路径中不要出现中文) 24 25  26 27 - 使用命令 `git clone {http}` 28 29  30 31- 直接下载zip 32 33#### 工具 34 351. DevEco Studio 3.0 Beta4 36 37- HUAWEI DevEco Studio For OpenHarmony是基于IntelliJ IDEA Community开源版本打造,面向OpenHarmony全场景多设备的一站式集成开发环境(IDE),DevEco Studio 3.0支持在HarmonyOS 3.0 Beta版上开发应用及服务,并已适配ArkUI声明式编程范式、ArkCompiler方舟编译,同时提供低代码开发、双向预览、全新构建工具、模拟器、调试调优、信息中心等功能,为开发者提供工程模板创建、开发、编译、调试、发布等E2E的OpenHarmony应用/服务开发。 38 392. 下载链接: [HUAWEI DevEco Studio和SDK下载和升级 | HarmonyOS开发者](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta) 40 413. 安装步骤: [下载与安装软件-快速开始-HUAWEI DevEco Studio For OpenHarmony使用指南-工具-HarmonyOS应用开发 | HarmonyOS](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-download-software-0000001218760592) 42 43注:建议在选项界面都勾选DevEco Studio,Add “bin” folder to the PATH,Add "Open Folder as Project" 44 454. 配置开发环境:[配置开发环境-快速开始-HUAWEI DevEco Studio For OpenHarmony使用指南-工具-HarmonyOS应用开发 | HarmonyOS](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-setting-up-environment-0000001263160443) 46 47#### 如何导入程序 48 491. 打开DevEco 50 512. 在DevEco Studio的欢迎页,选择**Open Project**开始创建一个新工程。 52 53 54 552.选择程序所在的路径 56 57 58 593. 打开程序的homepage 60 61 \communication_bluetooth\test\example\BluetoothTest\entry\src\main\ets\MainAbility\pages\homePage.ets 62 63 64 65- **entry**为应用的主模块,类似与Android Studio的app模块,一个APP中,对于同一设备类型必须有且只有一个entry类型的HAP,可独立安装运行。 66 67- 使用**previewer**查看程序的预览图 68 69 点击View > Tool Windows > Project > Previewer 如下图所示: 70 71 - 方法一: 72 73  74 75 - 方法二: 76 77  78 79 - 成功预览后会生成.preview结构: 80 81  82 83- 使用**build**编译程序 84 85 - 点击Build > Rebuild 进行编译; Build > Build Hap(s) /App(s) >Build Hap(s) 生成hap文件 86 87  88 89 - hap文件的生成路径:entry\build\outputs\default 90 91  92 93- 打开homepage点击预览,会显示蓝牙专项测试程序的主界面,如下图所示 94 95 96 97注:在预览中,点击具体的功能模块,能实现页面跳转。具体的方法实现,需要在开发板上完成。 98 99- 将搭载OpenHarmony标准系统的开发板与电脑连接。 100 101- 点击File > Project Structure > Project > Signing Configs界面勾选“Automatically generate signature”,等待自动签名完成即可,点击“OK”。如下图所示: 102- 为了保证OpenHarmony应用的完整性和来源可靠,在应用构建时需要对应用进行签名。经过签名的应用才能在真机设备上安装、运行、和调试。如果没有配置签名,会报错:hvigor WARN: Will skip sign ‘hap’,Invalid signingConfig is configured for 'default' product. 103 104<img src="InstructionDoc\project structure.png" alt="project structure" style="zoom:75%;" /> 105 106程序烧录 107 108 109 110--- 111 112### 安装使用说明(Open-Harmony) 113 114在开源鸿蒙系统下 115 116- 蓝牙专项应用程序路径为:foundation/communication/bluetooth/test/example/BluetoothTest 117 118- 编译命令 119 120 ~~~ 121 # 全量编译 122 ./build.sh --product-name {product_name} 123 124 # 单独编译HAP 125 ./build.sh --product-name {product_name} --build-target BluetoothTest 126 127- 生成文件 128 129 - 使用 find out -name "BluetoothTest.hap*" 查找生成文件,或者直接查看config.json所写的生成路径。 130 - 将生成文件拷到本地电脑上,连接板子,使用命令 `hdc_std.exe install BluetoothTest`进行安装。 131 - 使用命令 `hdc_std uninstall {安装包名}` 进行卸载。 132 - 安装包名在 `entry\src\main\config.json` 如:`"bundleName": "com.ohos.bttest"` 133 134- 补充 135 136 在鸿蒙系统下编译,仍存在高版本对低版本的编译不兼容性问题。即在mater版本下编译的hap无法在beta2版本运行;反之则可以。 137 138--- 139 140### 程序说明 141 142测试模块根据测试类型不同可以分为接口测试,自动化测试,场景测试,Profile测试,性能测试; 143 144根据测试的接口仓不同可以分为bluetooth仓的测试与bluetoothManager仓的测试。 145 146- 接口测试(ohos.bluetooth.d.ts) 147 148 >1. 经典蓝牙模块接口测试 149 > 150 > Br功能界面使用说明文档.md 151 > 152 >2. BLE蓝牙模块接口测试 153 > 154 > BLE功能界面使用说明文档.md 155 > 156 >3. Gatt模块接口测试 157 > 158 > Gatt功能界面使用说明文档.md 159 > 160 >4. SPP模块接口测试 161 > 162 > SPP功能界面使用说明文档.md 163 > 164 165 166 167 168 169- 接口测试(ohos.bluetoothManager.d.ts) 170 171 >1. 经典蓝牙Manager模块接口测试 172 > 173 > BrManager功能界面使用说明文档.md 174 > 175 >2. BLE蓝牙Manager模块接口测试 176 > 177 > BLEManager功能界面使用说明文档.md 178 > 179 >3. GattManager模块接口测试 180 > 181 > GattManager功能界面使用说明文档.md 182 > 183 >4. SPPManager模块接口测试 184 > 185 > SPPManager功能界面使用说明文档.md 186 187 188 189- 自动测试(ohos.bluetooth.d.ts) 190 191 >1. 经典蓝牙模块自动测试 192 > 193 >2. BLE蓝牙模块自动测试 194 > 195 >3. Gatt蓝牙模块自动测试 196 > 197 >4. SPP蓝牙模块自动测试 198 > 199 >5. Profile蓝牙模块自动测试 200 > 201 > 蓝牙自动测试使用说明文档.md 202 203 204 205 206 207- 自动测试(ohos.bluetoothManager.d.ts) 208 209 >1. 经典蓝牙Manager自动测试 210 > 211 >2. BLE蓝牙Manager自动测试 212 > 213 >3. Gatt蓝牙Manager自动测试 214 > 215 >4. SPP蓝牙Manager自动测试 216 > 217 >5. Profile蓝牙Manager自动测试 218 > 219 > 蓝牙Manager自动测试使用说明文档.md 220 221 222 223- 场景测试(ohos.bluetooth.d.ts) 224 225 >1. 经典蓝牙发现场景测试 226 > 227 >2. BLE蓝牙发现场景测试 228 > 229 >3. GattClient场景测试 230 > 231 >4. GattServer场景测试 232 > 233 >5. SppClient场景测试 234 > 235 >6. SppServer场景测试 236 > 237 > 蓝牙场景测试使用说明文档.md 238 239 240 241 242 243- 场景测试(ohos.bluetoothManager.d.ts) 244 245 >1. 经典蓝牙Manager发现场景测试 246 > 247 >2. BLE蓝牙Manager发现场景测试 248 > 249 >3. GattClientManager场景测试 250 > 251 >4. GattServerManager场景测试 252 > 253 >5. SppClientManager场景测试 254 > 255 >6. SppServerManager场景测试 256 > 257 > 蓝牙Manager场景测试使用说明文档.md 258 259 260 261- Profile测试(ohos.bluetooth.d.ts) 262 263 >1. A2dpSourceProfile测试 264 > 265 >2. HandsFreeAudioGatewayProfile测试 266 > 267 >3. HidHostProfile测试 268 > 269 >4. PanNetwork测试 270 > 271 > Profile功能界面使用说明文档.md 272 273 274 275 276 277- Profile测试(ohos.bluetoothManager.d.ts) 278 279 >1. A2dpSourceProfileManager测试 280 > 281 >2. HandsFreeAudioGatewayProfileManager测试 282 > 283 >3. HidHostProfileManager测试 284 > 285 >4. PanNetworkManager测试 286 > 287 > ProfileManager功能界面使用说明文档.md 288 289 290 291- 性能测试(ohos.bluetooth.d.ts) 292 293 >1. BrBenchmark测试 294 > 295 >2. BleBenchmark测试 296 > 297 >3. GattClientVelocityBenchmark / GattServerVelocityBenchmark测试 298 > 299 >4. SppClientVelocityBenchmark / SppServerVelocityBenchmark测试 300 > 301 >5. SppClientBandWidthBenchmark / SppServerBandWidthBenchmark测试 302 > 303 > 蓝牙性能测试功能界面使用说明文档.md 304 305 306 307 308 309- 性能测试(ohos.bluetoothManager.d.ts) 310 311 >1. BrManagerBenchmark测试 312 > 313 >2. BleManagerBenchmark测试 314 > 315 >3. GattClientManagerVelocityBenchmark / GattServerManagerVelocityBenchmark测试 316 > 317 >4. SppClientManagerVelocityBenchmark / SppServerManagerVelocityBenchmark测试 318 > 319 >5. SppClientManagerBandWidthBenchmark / SppServerManagerBandWidthBenchmark测试 320 > 321 > 蓝牙Manager性能测试功能界面使用说明文档.md 322 323 324 325 326 327