BTAccess .Net Architecture Review

Update 1/18/06
BTAccess v3.0 now supports Windows Mobile 5, the .Net Compact Framework v2.0, and the Widcomm bluetooth stack v1.6 and later.  The general information about .Net below still applies.

BTAccess v2.0 with .Net support involves 2 components:

1. New BTAccess.dll
We added a .Net extension to BTAccess.dll in the form of a C-style "flat" api.  This makes it easier to access via P/Invoke from .Net languages, while still allowing C++/MFC developers to use the C++ classes as usual.  One side effect of this approach is that now C-developers who don't want the overhead of MFC or .Net Compact Framework can call these C-style functions directly from their code.

2. New BTAccess Namespace
Even with the changes in BTAccess.dll, we still wanted to provide more natural-looking classes to native .Net programmers.  So we created a new BTAccess namespace that contains these classes plus the ugly "glue" code required to deal with P/Invoke.  This new namespace is offered in 3 forms for your convenience:

a) BTAccess.cs C# source code
Just add this source file to your C# project, add a "using BTAccess;" statement to your forms, and rebuild your program. You should not have to make any changes to this source file to use it.  Read up on the new classes in the updated BTAccess Help File.

b) BTAccessNet.dll assembly
We have built the BTAccess.cs source code into a separate assembly  (BTAccessNet.dll) so you can just add a Reference to it in your .Net project. The drawback with this approach is that yet another DLL for BTAccess must be copied to your PocketPC device, along with the standard BTAccess.dll.

c) Other .Net languages
For users of other .Net languages you can use a disassembly tool like .Net Reflector (see www.aisto.com/roeder/dotnet) to view our BTAccessNet.dll assembly's IL code in any language you like, and then copy/paste this new source code directly into your project as in a).  Unfortunately this process removes all comments and meaningful variable names but it should still work just fine.

BTAccess Namespace
The BTAccess namespace contains the BtStack and BtDevice C# classes, similar to the C++ BTAccess classes. It also contains a set of public enums and structure definitions required for both internal usage and user-application  usage.  Refer to the updated BTAccess Help File for complete details on the classes, properties, methods, and events.

BTAccess Events
The BtStack class implements a special MessageWindow override which receives  messages from BTAccess.dll. It then turns them into .Net events using standard delegates. See the StackDemoNet C# sample code in the BTAccess Evaluation Kit for an example of how to tie into these events.

BTAccess54 and BTAccessClassic now supported in .Net
We now include .Net upgrades for our two older BTAccess products too, after a surge of demand from customers who still support these devices.  Please be aware you will need to install .Net Compact Framework onto these devices since it did not ship with PocketPC or PocketPC2002.  Get the download here from Microsoft.

What about control of the Bluetooth Radio?