WinBeacon is a managed .NET (C#) library with a minimal Bluetooth LE Stack that is able to detect and act as iBeacon¹ and Eddystone. This stack doesn't support BLE devices, only the detection and transmission of BLE advertisement packets used by beacons.
- Windows XP (not tested, but it should work)
- Windows 7
- Windows 8
- Windows 10*
* For Windows 10, you should be able to use BluetoothLEAdvertisementWatcher instead of this library.
Manufacturer | Product | Chipset | VID / PID | Compatible |
---|---|---|---|---|
ASUS | USB-BT400 | BCM20702A0 | VID_0B05 PID_17CB | Yes |
Belkin | Mini Bluetooth 4.0 Adapter Class 2.10M | BCM20702A0 | VID_050D PID_065A | Yes |
Pluggable | USB Bluetooth 4.0 Low Energy Micro Adapter | BCM20702A0 | VID_0A5C PID_21E8 | Yes |
CSR | USB Bluetooth 4.0 | CSR8510 | VID_0A12 PID_0001 | Yes |
If anyone can test with other BT4.0 dongle types, please let me know how it works out or send us a pull request.
This library needs raw USB access to a BT4.0 dongle. Therefore you should replace the original driver of the dongle with a WinUSB driver. This also means that the default Bluetooth stack is no longer used and Windows will no longer detect the dongle as a Bluetooth dongle until you re-install the original drivers.
To replace or create a WinUSB driver for the BT4.0 dongle, we advise you to use the Zadig tool.
Install-Package WinBeacon
using (var hub = new Hub(0x050D, 0x065A))
{
hub.BeaconDetected += (sender, e) =>
{
Console.WriteLine("Detected beacon: {0}", e.Beacon);
};
Console.ReadKey();
}
using (var hub = new Hub(0x050D, 0x065A))
{
hub.EnableAdvertising(new Beacon("B9407F30-F5F8-466E-AFF9-25556B57FE6D", 1000, 2000, -52));
Console.ReadKey();
}
Currently only the detection of Eddystone UID and URL is supported.
using (var hub = new Hub(0x050D, 0x065A))
{
hub.EddystoneDetected += (sender, e) =>
{
switch (e.Eddystone)
{
case EddystoneUid eddystoneUid:
Console.WriteLine($"Eddystone UID: {eddystoneUid}");
break;
case EddystoneUrl eddystoneUrl:
Console.WriteLine($"Eddystone URL: {eddystoneUrl}");
break;
}
};
Console.ReadKey();
}
¹ iBeacon is a trademark of Apple inc.