We can already enable and disable Bluetooth on devices equipped with Microsoft’s Bluetooth stack. In the case of iPaq devices, which use the Widcomm stack, it is possible to toggle the radio state using an API provided in HP’s iPAQUtil.dll. This can be P/Invoked from a .NETCF project like so:-
[DllImport(“iPAQUtil.dll”, SetLastError=
true)]public static extern bool iPAQSetBlueToothRadio(ref int lpdwValue);
Which you can then call with:-
int
val = 0;iPAQSetBlueToothRadio(
ref val);Where val is either 0 to disable Bluetooth, or 1 to enable it. Tested on an iPaq 2210 but should work on any other iPaq device with Bluetooth.
Update:-
The following should also work for devices with WiFi built in:-
[DllImport(“iPAQUtil.dll”, SetLastError=
true)]public static extern bool iPAQSetWLANRadio(ref int lpdwValue);But I’ve not been able to test this myself.
One reply on “Toggle Bluetooth on an iPaq device”
This is just what I’ve been looking for – excellent – thanks. One strange thing though – toggling the Wireless LAN works fine. Toggling Bluetooth causes even the built in HP software to think bluetooth has been disabled/enabled, but doesn’t actually do it! However, if I do use the built in software it works fine. Is this just me or has anyone else seen this?