I am in the process of writing a bluetooth scanner to monitor traffic outside my house. I understand that car BT devices generally have 3 states, visible (always on), limited, and invisible.
I'm using asynchronous device discovery with the Bluesoleil drivers, and a Class 1 Bluetooth dongle.
My problem is the device name and device class isn't being discovered. It is discovering the device address, and the range, but not the name of the device.
I have tried using System.Threading.Thread.Sleep(1000) then calling device.Refresh() to no avail.
It is picking up the name of a few things that are in range, like TVs, and Fitbit Flexes, but it's important that I can find the name and CoD of the car bluetooth devices, not just the MAC address and the range.
public void SetupListener()
{
var client = new BluetoothClient();
var component = new BluetoothComponent(client);
component.DiscoverDevicesAsync(255, false, false, true, false, null);
component.DiscoverDevicesProgress += component_DiscoverDevicesProgress;
component.DiscoverDevicesComplete += component_DiscoverDevicesComplete;
}
void component_DiscoverDevicesComplete(object sender, DiscoverDevicesEventArgs e)
{
SetupListener();
}
void component_DiscoverDevicesProgress(object sender, DiscoverDevicesEventArgs e)
{
BluetoothDeviceInfo[] availableDevices = e.Devices as BluetoothDeviceInfo[];
foreach (BluetoothDeviceInfo device in availableDevices)
{
device.Refresh();
var name = device.DeviceName; // This mostly returns the MAC address
var cod = device.ClassOfDevice.Device; // This mostly returns Miscellaneous
}
}
The application I've built is a simple WPF form that dumps the found devices to a datagrid (which I've removed from the code for simplicity's sake). This is generally what the results look like.
When I sit outside closer to the road, it is definitely picking up more and more devices as cars drive by, but I can't tell what type of device it's detecting.
Any help would be greatly appreciated.