[英]Alternative to BluetoothGetRadioInfo on Windows Server 2008 r2
I have a C++ Windows Bluetooth application that is built on a Jenkins CI server running 2008 r2. 我有一个在运行2008 r2的Jenkins CI服务器上构建的C ++ Windows蓝牙应用程序。 The application builds fine and runs on machines that have the Microsoft Bluetooth stack installed.
该应用程序可以很好地运行,并且可以在安装了Microsoft蓝牙堆栈的计算机上运行。 Unfortunately, there is no Bluetooth support on Server 2008 r2, which prevents execution of our gtest unit test projects on the build server.
不幸的是,Server 2008 r2上没有蓝牙支持,这阻止了我们在构建服务器上执行gtest单元测试项目。
The unit tests themselves do not utilize the Bluetooth stack, but because other library code contains calls to BluetoothFindFirstRadio and BluetoothGetRadioInfo, the unit test application will not run at all. 单元测试本身并不利用蓝牙堆栈,但是由于其他库代码包含对BluetoothFindFirstRadio和BluetoothGetRadioInfo的调用,因此单元测试应用程序将根本无法运行。 These calls are implemented in bthprops.cpl, which is not present in Windows Server 2008 r2.
这些调用在bthprops.cpl中实现,而Windows Server 2008 r2中不存在。
So I could solve this in several ways, but unfortunately I can't find the answers to any of these questions: 因此,我可以通过多种方式解决此问题,但不幸的是,我找不到以下任何问题的答案:
1) Is there an alternative method of acquiring the address of a local Bluetooth device other than BluetoothGetRadioInfo? 1)除了BluetoothGetRadioInfo之外,还有其他获取本地蓝牙设备地址的方法吗? This would allow me to break the link dependency on bthprops.cpl.
这将允许我打破对bthprops.cpl的链接依赖性。
2) Is there a way to trick Windows Server 2008 into thinking that the bthprops.cpl library is on the machine? 2)有没有一种方法可以使Windows Server 2008认为bthprops.cpl库位于计算机上? Or even to trick my unit test executable into thinking it's there so that it can execute?
甚至欺骗我的单元测试可执行文件以为它在那里可以执行?
3) Is there a way to recognize at compile time that I'm on Windows Server so I can #ifdef those functions out of my unit test projects? 3)有没有一种方法可以在编译时识别我在Windows Server上,因此可以从单元测试项目中#ifdef这些功能?
Thanks! 谢谢!
I sussgest you using LoadLibrary/FreeLibrary and GetProcAddress to get function pointers of BluetoothFindFirstRadio/BluetoothGetRadioInfo/..., so your application can run normally without system error ("The program can't start because bthprops.cpl is missing from your computer. Try reinstalling the program to fix this problem.") no matter there is bthprops.cpl or not. 我怀疑您使用LoadLibrary / FreeLibrary和GetProcAddress来获取BluetoothFindFirstRadio / BluetoothGetRadioInfo / ...的功能指针,因此您的应用程序可以正常运行而不会出现系统错误(“该程序无法启动,因为您的计算机缺少bthprops.cpl。请尝试。重新安装程序以解决此问题。“)无论是否存在bthprops.cpl。
I hope this is helpful to you! 希望对您有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.