简体   繁体   中英

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. The application builds fine and runs on machines that have the Microsoft Bluetooth stack installed. Unfortunately, there is no Bluetooth support on Server 2008 r2, which prevents execution of our gtest unit test projects on the build server.

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. These calls are implemented in bthprops.cpl, which is not present in 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? This would allow me to break the link dependency on bthprops.cpl.

2) Is there a way to trick Windows Server 2008 into thinking that the bthprops.cpl library is on the machine? 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?

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.

I hope this is helpful to you!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM