人机设备适配器
人工设备适配器 (HDA) 是手动与蓝牙测试平台 (BTP) 交互的一种自助方法,允许将设备与尚未自动化的 BTP 配合使用。 例如,HDA 可以与购买的以其他方式无法明确连接到 BTP 的头戴显示设备交互。 HDA 可在 Windows 设备与原型制作硬件之间实现手动用户测试,而无需使用外部硬件,例如 Traduci。 因此,设置所需的所有设备都是支持蓝牙和你自己的测试设备的电脑。
设置 HDA
按照 BTP 软件安装程序中所述安装软件以支持 HDA。
HDA 配置文件
创建一个以测试设备命名的配置文件,例如:mytestdevice.txt。 文件名和扩展并不重要。 配置文件应包含以下信息:
name=myTestDevice
baseband=BR
br_address=B4:F1:DA:96:C0:A4
HDA 配对测试
转到提取 BTP 软件包的文件夹,通常为 C:\BTP
。 这些脚本位于包目录的子文件夹中。 为所需的命令环境运行相应的脚本:
命令环境 | 脚本 |
---|---|
提升的命令提示符 | RunPairingTests.bat HDA,conf_file=<configuration file name> |
提升的 PowerShell 控制台 | RunPairingTests.ps1 HDA,conf_file=<configuration file name> |
可以添加可选参数 -VerboseLogs
来提供 BTP 内部操作的更详细输出,以协助调试。
HDA 手动配对
该脚本会询问设备之前是否已配对。 如果你以 y 做出响应,脚本将删除配对。 如果你以 n 做出响应,则该过程将继续,而不执行任何操作。
Verify: SUCCEEDED(WEX::TestExecution::RuntimeParameters::TryGetValue(deviceParameterName.c_str(), deviceParametersStr)): Getting required runtime parameter 'central' [BluetoothTests::PairingTestsImpl::PairingTestsImpl]: Using central device named: MyCentralDevice [BluetoothTests::PairingTestsImpl::PairingTestsImpl]: Using peripheral device named: MyTestDevice [BluetoothTestHelpers::Pairing::Unpair]: Unpairing device with address B4F1DA96C0A4 from the device with address D83BBFAC35607 [BluetoothTestHelpers::Pairing::Unpair]: Unpaired successfully [BluetoothTestHelpers::Pairing::WaitForDisconnection]: Waiting for disconnection of device with address B4F1DA96C0A4 [BluetoothTestHelpers::Pairing::WaitForDisconnection]: Asserted: connectionModule.WaitForDisconnection(otherDeviceAddress, c_disconnectionAfterUnpairingTimeout) [BluetoothTestHelpers::Pairing::WaitForDisconnection]: Disconnected successfully Is MyTestDevice paired to the device with address D83BBFAC35607? Enter (y/n): y
以下示例演示了删除配对的 HDA。 它还会提示你删除设备上的任何配对信息(此处名为“MyTestDevice”)。 删除任何配对信息后,按任意键继续。
[BluetoothTestHelpers::Pairing::Unpair]: Unpairing device with address D83BBFAC35607 Public from the device with address D83BBFAC35607 Public If possible, delete the pairing on MyTestDevice Press any key to continue
然后,该脚本回开始配对过程,方法是运行检查,然后提示用户让其设备(此处名为“MyTestDevice”)进入“带配对模式”。 将设备置于配对模式后,按任意键继续。
StartGroup: BluetoothTests::TaefPairingTests::OutgoingJustWorksPairingTest [BluetoothTests::PairingTestsImpl::OutgoingJustWorksPairingTest]: Will attempt an outgoing pairing to the peripheral device and validate that a JustWorks ceremony was used [BluetoothTestHelpers::Pairing::Pair]: Asserted: (originDeviceAssociationModule) != nullptr [BluetoothTestHelpers::Pairing::Pair]: Asserted: originDeviceAssociationModule->CanInitiatePairing() [BluetoothTestHelpers::Pairing::Pair]: Asserted: originDeviceAssociationModule->CanCheckPairingStatus() [BluetoothTestHelpers::Pairing::Pair]: Asserted: !(originDeviceAssociationModule->IsPairedTo(destinationDeviceAddress)) If not already, put MyTestDevice in BR pairing mode Press any key to continue . . .
该脚本会启动配对。 如果配对成功,你将看到以下输出。 响应设备或测试电脑上的所有通知,以确认和完成配对。 然后,测试会提示你使设备退出配对模式。 将设备退出配对模式后,按任意键继续。
[BluetoothTestHelpers::Pairing::Pair]: Initiating pairing request from device with address D83BBFAC35607 to device with address B4F1DA96C0A4 [BluetoothTestHelpers::Pairing::DefaultPairingCeremonyHandler::OnJustWorks]: JustWorks ceremony used [BluetoothTestHelpers::Pairing::Pair]: Asserted: originDeviceAssociationModule->IsPairedTo(destinationDeviceAddress) [BluetoothTestHelpers::Pairing::Pair]: Asserted: ceremonyHandler.GetLastCeremonyUsed().has_value() [BluetoothTestHelpers::Pairing::Pair]: Asserted: ceremonyHandler.GetLastCeremonyUsed().value() == expectedCeremony [BluetoothTestHelpers::Pairing::Pair]: Paired successfully If the device is in pairing mode, exit pairing mode if possible. Press any key to continue . . .
配对完成后,脚本将继续执行测试套件中可用的测试。 有关可用测试以及如何运行这些测试的文档,请参阅当前支持的 BTP 测试
HDA 日志捕获
如果遇到问题,可以通过按照 GitHub 上用于日志捕获的 Busiotools for Windows 存储库中的说明或在启动测试时使用脚本选项 -VerboseLogs
来捕获蓝牙日志。