Since starting on the Widcomm support its always been hoped that we could allow applications to use both the Microsoft and Widcomm stack at the same time (or any combinations of stacks supported on the machine).  Then an application could connect to more devices than it could when just using one stack alone.  This is partly necessary because those two stacks each only support one connected radio (Bluetooth Controller) — unlike BlueZ on Linux for instance which supports more than one.

I’ve added support for loading two or more stack types at a time in the library in preparation for this (it’s disabled in the 2.4 release however).  However, although I’ve not had a lot of time to play with this, I haven’t managed to get the two stacks to work at the same time.  It appears that even if the MSFT stack support isn’t loaded but I have my MSFT-stack dongle connected then the Widcomm API doesn’t work…  Has anyone else seen this?  Maybe it’s Widcomm version dependent?  I’m using 3.0.1.912 (via Belkin).

Has anyone else tried this scenario?

 

There are various ways to disable loading the MSFT stack.  Either run in the debugger and set a breakpoint in InTheHand.Net.Bluetooth.BluetoothFactory.GetStacks_inLock, and don’t allow the loop to load the MSFT stack factory.  Or, the correct way is to use configuration settings.  After 2.4 I’ve added this support.  Add a configuration file like the following to disable the MSFT stack.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <sectionGroup name="InTheHand.Net.Personal">
      <section name="BluetoothFactory"
           type="InTheHand.Net.Bluetooth.BluetoothFactorySection, InTheHand.Net.Personal"
           requirePermission="false" />
    </sectionGroup>
  </configSections>
  <!-- -->
  <InTheHand.Net.Personal>
    <BluetoothFactory>
      <stackList>
        <remove name="InTheHand.Net.Bluetooth.SocketsBluetoothFactory" />
      </stackList>
    </BluetoothFactory>
  </InTheHand.Net.Personal>
</configuration>

And in passing, to enable multi-stack support in the library (with all errors reported) use a configuration file with the following element. 🙂

...
<BluetoothFactory reportErrors="true"
    oneStackOnly="false" >
</BluetoothFactory>
...
Advertisements