How to programatically detect if the BTH-1208LS is connected via USB or Bluetooth
The BTH-1208LS has two modes of connection; Bluetooth and USB.
This is an important distinction because product performance is linked to the type of connection.
The device can acquire data at a much higher rate when it is connected via USB. This is due to the bandwidth of the interface.
When the BTH-1208LS is connected via USB, it can acquire analog data at an aggregate rate of up to 50 KHz. When connected via Bluetooth, it can acquire at an aggregate rate of up to 1024 Hz.
You may want your program to know how it is connected so it can automatically adjust itself to the correct acquisition rate. This is helpful so as not to generate errors when the rate is set higher than the 1024 Hz allowed when in Bluetooth mode.
You can do this by using the Universal Library's BoardConfig.GetBoardType() method.
If you are using a WIN32 API, call cbGetConfig(), where the Infotype parameter is set to BOARDINFO, and ConfigItem Parameter is set to BIBOARDTYPE.
It gets the unique number (device ID) assigned to the board (between 0 and 8000h) indicating the type of board installed.
The BTH-1208LS has two BoardType identifiers:
USB connection = 282 (0x11A)
Bluetooth Connection = 283 (0x11B)
In a program, you could have a Rate textbox and Number of Samples text box set up to default like this:
'ConnectionType = Bluetooth (Default)
txtRate.Text = 1024
txtNumSamples.Text = 512
When your program starts, during the form_load event, you could have syntax similar to this:
ulstat = Daqboard.BoardConfig.GetBoardType(typeVal) 'Bluetooth or USB connection?
If typeVal = 282 Then 'ConnectionType = USB
txtRate.Text = 10000
txtNumSamples.Text = 2000
End If
This snippet of code is included in the Product Specific Examples for the BTH-1208LS in VB.NET and C#.NET.