views:

1713

answers:

3

I need to connect to a Bluetooth device through virtual COM port created in Windows. It's easy when the port has been already created during manual pairing procedure. But I would like my application to relieve an user from the manual pairing of a device. I would like to present all devices in the range, allow user to chose one, and then create virtual COM port connected with the selected device. I'm not trying to avoid the pairing procedure itself, but rather I would like to invoke it by my application.

I started getting familiar with Microsoft Bluetooth API. And then some doubts arose. I've been wondering what happen if some user would use different (than Microsoft's) Bluetooth stack? Is the Microsoft's API the real Bluetooth API, which have to be implemented by any other Bluetooth stack provider? Or rather each provider has its own API, and the Microsoft's is only one of many other?

+1  A: 

I can't speak for the Microsoft Bluetooth API, but there are multiple Bluetooth stacks available for the PC platform (even more for mobile devices).

The underlying API is defined by the Bluetooth Core Spec and so all stacks should be able to interact, in fact it is mandatory that they interop or they cannot use the Bluetooth name and logo.

As to pairing, your going to have a hard time getting devices to pair if they have default security, which requires a pin code.

Things might be simpler in the (near) future, as the Bluetooth standard has introduced a new security model, secure simple pairing, which has a 'just works' mode that requires no Pin code. This is still stronger then the current security, except against Man in the middle attacks. However, it could be a while before you see the chips with this feature in PCs.

Pev
Thanks for the answer.To be more specific, I'm not trying to avoid pairing, at all. Actually, I would like to start pairing procedure from my application if the device hasn't been already paired. I would like to do this regardless of the installed stack (if possible) and this is the reason I asked about Bluetooth API available on Windows. If I could use the API regardless of the underlying stack it would be great. If all stack provided their own APIs, I would need to program against each of them...
oo_olo_oo
+1  A: 
alanjmcf
Thank you for the hints. Unfortunately, I need to support more stacks than two managed by your library... But, anyway, you indirectly answered my question about Bluetooth APIs, provided by different Bluetooth stacks - they are not interchangeable, and each of them have to be handled separately.
oo_olo_oo
A: 

Thanks everyone for valuable input. I'd like to summarize what I've found so far. The Microsoft Bluetooth API is not operating system API. Application written against it will not cooperate correctly with any other Bluetooth stack. It seems that applications which are intended to cooperate with multiple stacks need to provide some stack abstraction layer, and stack specific code for all of them.The other solution is to allow user for manual pairing of the Bluetooth device, which eventually create some virtual device in the operating system (e.g., COM port). Then the application can use standard interface of such a device.

oo_olo_oo