Tuesday, September 12, 2006

Unified Bluetooth stack access for Windows Mobile

After considering the apparently big differences between the Microsoft and the Widcomm Bluetooth stacks, I found out that there is a way to make them work under a similar API. This is especially useful for Compact Framework developers although some native developers may also benefit from a simple C type API.

The Widcomm API is oriented to C++ developers and exposes itself as a set of C++ classes that are supposed to be consumed either as-is or derived in your application. Exposing this type of API to a .NET CF developer is nothing short of impossibe unless a C layer is developed to consume the Widcomm stack while exposing a set of simple functions.

While I was writing this piece of code, I found out that the Microsoft stack could also be subject to the same treatment. So my idea was to produce two DLL files with exactly the same function exports, one for the Widcomm stack and the other for the Microsoft stack. The obvious advantage of this is that now a .NET CF application can consume the existing Bluetooth stack without having to consider the differences between the Microsoft and the Widcomm stack.

I have to say that this was a very interesting learning project, thanks to Peter Foot's help. The resulting code will be published under a series of articles and, time permitting, I will try to integrate the code in Peter's own 32feet.NET project.

4 comments:

paryeni said...

Hi, what is the progress on this one? Have you yet integrated code with 32feet project?

João Paulo Figueira said...

The code is done for device discovery and services enumeration. I will post the code in an article before the end of the year. Before that I will write another article on SDP record enumeration with the Microsoft stack.

Eric said...

Hi, Not being pushy but we're past the end of the year. I need to interface to the Widcomm stack for a project, and there's no budget left to buy a commercial library.

Even a how to on how to write the C++ wrapper and package into a dll would help...

Chris Martin said...

Please, please, please release these bits! ;)