Bluetooth NETCF

Bluetooth Library (February Edition)

Not a huge amount of change since last months release but I just wanted to post the latest update. The download includes the same Chat application samples along with the complete solution for the library itself.


The main changes in this release are:-

  • BluetoothRadio class which handles the radio state on a single or multiple radio device. Multiple radios are only supported on XP, Windows CE supports a single radio device.
  • BluetoothSecurity class which has a couple of methods to automate the pairing (bonding) process between devices. Using SetPin and RevokePin you can specify the PIN to use with a particular remote device. Using PairRequest you can force the device to intiate a connection and bond with the remote device with the specified PIN code. Currently the BluetoothSecurity class is built for Windows CE only, in a future update this functionality will be extended to run on the desktop too.
  • General housekeeping – P/Invokes have been moved into a single NativeMethods class and a few new ones added, though not all are used by the library yet.

Online documentation for this build can be browsed here.

By Peter Foot

Microsoft Windows Development MVP

12 replies on “Bluetooth Library (February Edition)”

Hi Peter, I wonder if there is an application that enables the smartphone user to send a file to all the bluetooth phones/devices that it finds? If not, how hard is it to develop?

César, thats correct, however bonded devices are stored in the registry and the BondedDevices property returns a collection of these. There is no indication with these of course if the device is currently available and in range so a connection may not succeed.


Hi Peter

Well, I guess you might have saved my day by publishing this great library. I do have some troubles making it work though, as I recieve an exception when creating an instance of OpenNETCF.Net.Sockets.BluetoothClient. The exception message is as follows:

An address incompatible with the requested protocol was used

I am not sure if my bluetooth device uses the microsoft stack (I think it might uses the WidComm stack). Does this incur a problem? I am developing on my PC?

Hi Peter,

Apparently my PPC will lost its pairing info with a bluetooth printer, even i had manually paired before. I am wondering, can i use ur library to pair the bluetooth printer programmatically? I using eVC++ as development language. Is is supported? Thanks in advance.

I have downloaded v1.2.50205 and get the following error in the bluetoothchat application in the chatform.cs (at line 07 in the clip below)

I only get the error on my HP Ipaq hx4700, not in the emulator.

An unhandled exception of type ‘System.Net.Sockets.SocketException’ occurred in System.dll

Additional information: An address incompatible with the requested protocol was used

01 public class ChatForm : System.Windows.Forms.Form
02 {
03 internal System.Windows.Forms.MainMenu MainMenu1;
04 const int MAX_MESSAGE_SIZE = 128;
05 const int MAX_TRIES = 3;
06 private System.Guid ServiceName = new System.Guid("{E075D486-E23D-4887-8AF5-DAA1F6A5B172}");
07 OpenNETCF.Net.Sockets.BluetoothClient btClient = new OpenNETCF.Net.Sockets.BluetoothClient();
08 OpenNETCF.Net.Sockets.BluetoothListener btListener;
09 private bool listening = true;
10 string str;
12 public ChatForm()
13 {
14 //base.New();
15 InitializeComponent();
16 }

any help would be appreciated

Comments are closed.