1
votes

I am using the 32feet bluetooth library to connect to a device that supports Serial Port Profile (SPP). I try to connect like this:

 using (BluetoothClient client = new BluetoothClient())
 {
            var address = new BluetoothAddress(0xecfe7e11c3af);
            BluetoothEndPoint endPoint = new BluetoothEndPoint(address, BluetoothService.SerialPort);
            client.Connect(endPoint);
            var stream = client.GetStream();
            System.Threading.Thread.Sleep(10000);
 }

Everything is great until the Connect method is called. At this point, Windows interrupts the program flow with a bubble alert that says

"A bluetooth device is trying to connect -- click to allow this"

At which point the user is led through a wizard that ends up installing drivers and a Bluetooth virtual COM port shows up in Device Manager. I don't want this to happen -- I want to simply access the stream and communicate directly with the device without windows intervening. Is this possible? What can be done to tell Windows to keep out of my business?

I'm attempting to connect to a Bluetooth 4.0 device. I've done something similar in the past with a 2.0 device and Windows does not interfere in this case.

1

1 Answers

0
votes

Have a look at http://SimpleBluetooth4Win.SourceForge.net

It's a small wrapper library that uses the windows bluetooth networking API that could help you.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa362932%28v=vs.85%29.aspx

In particular if your bluetooth USB dongle or bluetooth device has been correctly recognized by the appropriate drivers and the remote bluetooth device is already paired with the PC, you don't need to install a bluetooth virtual COM port that shows up in Device Manager but you simply use the write or read calls to access directly the stream for communicating with the paired device.