I have been working on providing support for the BlueSoleil stack on (desktop) Windows.  This stack seems a common one to be included with dongles, and people have been asking for it.  One good thing about it is that it supports RSSI measurements which the Microsoft stack on Windows does not. (I must write a post sometime of the Microsoft driver engineer’s reasons for not supporting RSSI).

I have checked the code into our code repository at 32feet.codeplex.com and would be pleased to get your feedback.

Download the code from there (whether as a ZIP or as a SVN checkout etc) and compile the main library (InTheHand.Net.Personal.FX2) (actually v3 would likely do) and the SeparateBlueSoleil project.  Then follow the instructions below — which are from the “32feet BlueSoleil Test.html” file which is included in the repository.

Radio, DeviceInfo, and Discovery including ‘live discovery’ are working well.  BluetoothClient is ok, but there is no support currently(?) for Listener.  There’s still work to be done on checking what fails when the radio is disabled, and also on mapping of BlueSoleil’s errors into SocketException etc errors — currently a special BluesoleilException is thrown for any BlueSoleil API error.

Data transfer is less good however.  Rather than providing access to the connection to the remote RFCOMM endpoint as a socket or through another API, the access instead is through a virtual COM port, which the stack creates automatically when an RFCOMM connection is made.  This causes a number of problem, (no notification of disconnect, error on reading when the buffer is empty, data loss when writing too much), which I should write about elsewhere.  I’ve done a lot of work to workaround those problems so things should be ok.  Let me know what you find.

Alan


Usage

  1. Compile the SeparateBlueSoleil project — the code will be included in the main assembly eventually.
  2. Tell the library to load the code from there. To do this use a “app.confile” file containing the following, renamed to match your application e.g. to “myapp.exe.config”:
    <?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 reportAllErrors="false" oneStackOnly="false">
          <stackList>
            <add name="InTheHand.Net.Bluetooth.BlueSoleil.BluesoleilFactory, SeparateBlueSoleil" />
          </stackList>
        </BluetoothFactory>
      </InTheHand.Net.Personal>
      <!-- -->
      <system.diagnostics>
        <trace autoflush="true" indentsize="4">
          <listeners>
            <add name="myListener"
               type="System.Diagnostics.TextWriterTraceListener"
               initializeData="trace.log" />
          </listeners>
        </trace>
      </system.diagnostics>
    </configuration>
  3. Check that the support has loaded.
    1. Check whether BluetoothRadio.PrimaryRadio and/or BluetoothRadio.AllRadios are non-empty, and that one has SoftwareManufacter containing a BlueSoleil value.
    2. Check what’s in the trace.log file. It should contain something like the following.
      BlueSoleil Btsdk_Init: OK=0x0000
      BlueSoleil IsBluetoothReady: True, IsBluetoothHardwareExisted: True
      BlueSoleil Btsdk_StartBluetooth: OK=0x0000
      BlueSoleil IsBluetoothReady: True, IsBluetoothHardwareExisted: True
      Num factories: 1, Primary Factory: BluesoleilFactory
      BlueSoleil Radio mode: BTSDK_GENERAL_DISCOVERABLE, BTSDK_CONNECTABLE, BTSDK_PAIRABLE
  4. See below for what is and isn’t supported.

Advertisements