Hi, I'm new to BlueTooth, and while I've searched the forum and haven't found an answer I start by apologizing if the answer is obvious. That being said, here's my problem: I'm trying to access bluetooth through C# (.NET 3.5), and as of now have not been able to even get discovery to work. I'm using 32feet.NET.2.3. I've tried both SelectBlueToothDeviceDialog() and BluetoothClient.DiscoverDevices. Both attempts come back empty. I then found code that suggested first checking BluetoothRadio.IsSupported, and sure enough, that comes back false. I am able to just right click on my bluetooth icon and have it successfully discover a few different devices, so I know my PC (IBM ThinkPad) is enabled for it. The driver is from Broadcom dated 4/20/2006, and I did run "Update Driver" prior to this.
Here are the two different code snippets (both of which I shamelessly grabbed from this forum and other google results)...
using
InTheHand.Net.Sockets;
using
InTheHand.Net.Bluetooth;
using
InTheHand.Net;
using
InTheHand.Windows.Forms;
private void bluetoothDiscover1()
{
try
{
if (!BluetoothRadio.IsSupported){
Trace("BluetoothRadio not supported");return;
}
}
catch
{
Trace(
"BluetoothRadio not supported!");return;
}
if (BluetoothRadio.PrimaryRadio.Mode == RadioMode.PowerOff)
BluetoothRadio.PrimaryRadio.Mode = RadioMode.Connectable ;
Trace(
"BlueTooth radio name: " + BluetoothRadio.PrimaryRadio.Name.ToString());Trace("BlueTooth radio mode: " + BluetoothRadio.PrimaryRadio.Mode.ToString());
BluetoothClient bc = new BluetoothClient();BluetoothDeviceInfo[ devices = bc.DiscoverDevices();
Trace(
tracelevel.NORMAL,"BTdevtot: " + devices.Length);for (int i = 0; i < devices.Length; i++)
{
Trace(
devices
.DeviceName + ":" + devices
.DeviceAddress);
}
}
Snippet #2:
private void bluetoothDiscover2()
{
SelectBluetoothDeviceDialog sbdd = new SelectBluetoothDeviceDialog();sbdd.ShowUnknown = true;
sbdd.ShowRemembered =
true;sbdd.ShowAuthenticated = true;if (sbdd.ShowDialog() == DialogResult.OK)
{
}
}
For bluetoothDiscover1, BluetoothRadio.IsSupported is false.
For bluetoothDiscover2, the dialog box comes up, but there's never a discovery.
Any thoughts?
Thanks in advance.