As they say Necessity is mother of invention, I recently got a Jabra BT3030 Bluetooth headset. I paired it to my Windows Mobile phone. When I wanted to turn on the Bluetooth, I had to go to wireless manager and turn it on. I am a little bit lazy and had an idea why not map a button on the phone to toggle the bluetooh radio. But, this is not possible by default, so started working on a program to map to the button.
Fortunately it is very simple to interact with Bluetooth radio and devices on the phone using Windows Embedded Source Tools for Bluetooth Technology. This download contains bunch of C# files which you can directly use in your code. You will get classes such as BluetoothDevice and BluetoothRadio which allow you to control the device and paired devices.
1: using System;
2: using System.Collections.Generic;
3: using System.Text;
4: using Microsoft.WindowsMobile.SharedSource.Bluetooth;
6: namespace ToggleBluetooth
8: class Program
10: static void Main(string args)
12: BluetoothRadio brad = new BluetoothRadio();
13: if (brad.BluetoothRadioMode == BluetoothRadioMode.Off)
14: brad.BluetoothRadioMode = BluetoothRadioMode.On;
16: brad.BluetoothRadioMode = BluetoothRadioMode.Off;
After that, I added a setup project and made sure that a shortcut for the application is under Programs folder, so that I can map it using the Buttons applet of Settings panel. After the install on the device, you should be able to see the program in the "Assign a program" list.
As usual, here are some links and blog post.
Windows Embedded Source Tools for Bluetooth Technology - http://msdn.microsoft.com/en-us/embedded/aa714533.aspx
Channel 9 Wiki (has a good Q&A) - http://channel9.msdn.com/wiki/bluetoothdevelopment/
MSDN Code Samples page - http://msdn.microsoft.com/en-us/library/bb158662.aspx