Search code examples
c#bluetoothwindows-ce32feet

Starting the Bluetooth controller on Windows CE programmatically


I'm working on a C# project for a Mobile Data Terminal that runs Windows CE 6.0. I'm using 32feet.NET to connect to a Bluetooth device. The MDT has built in Bluetooth and Microsoft's Bluetooth Driver Stack is installed, but I believe it's not loaded automatically.

Every time after I reset the MDT, my program can't find any Bluetooth devices with 32feet's BluetoothClient.DiscoverDevices and when I run Bluetooth Device Properties from the control panel and hit Scan Device I get an error message claiming that "Bluetooth hardware error 10050 (controller not present)".

Now, there is another, third party, application installed on the MDT. This program seems to be able to start that controller up. If I just open that program and close it immediately after it's done loading, the Bluetooth works again - the device manager in the control panel can scan and find Bluetooth devices and my program can find them with BluetoothClient.DiscoverDevices.

Now, I don't want to have to start that program manually each time I want to run my project after a reset. I want to start up the Bluetooth controller from my own program. Is there any way to do it either via 32feet.NET or from some other underlying API?


Solution

  • Try

    var r = BluetoothRadio.PrimaryRadio;
    if (r == null) { blahhhhh....; return; }
    r.Mode = RadioMode.Connectable;
    

    I can't remember if that works -- I have half a memory that it does on WM+MSFT.

    LATER: Sorry to hear it doesn't work on your device. I'm not doing much with WM/CE so can't offer any more help.