One of the communication protocols not present in .NET Framework class libraries is Bluetooth. So today, I started to work on my implementation of a managed API for Bluetooth programming – WinToolZone.Bluetooth. I am authoring it using Managed C++ and leveraging the Microsoft Bluetooth stack APIs.
I just completed implementing the support for enumerating the Bluetooth radios on a machine. Below is a C# program that exemplifies how they can be enumerated:
using System;
using System.Collections.Generic;
using System.Text;
using WinToolZone;
namespace BTHCSClient
{
class Program
{
static void Main(string[] args)
{
Bluetooth bth = new Bluetooth();
if (bth.RefreshRadios())
{
foreach (BluetoothRadio radio in bth.Radios)
{
Console.WriteLine("RadioName: {0}", radio.Name);
Console.WriteLine("Address: {0}", radio.Address.ToString());
Console.WriteLine("ManuID: {0}", radio.ManufacturerID);
Console.WriteLine("LMPSubversion: {0}", radio.LMPSubversion);
Console.WriteLine("DeviceClass: {0}", radio.DeviceClass);
}
}
else
{
Console.WriteLine("Unable to enumerate BTH radios");
}
}
}
}