I'm developing a C# WinForms app on Windows 10. I want to perform a Bluetooth environment scan and get devices list all around the PC. I also want the RSSI of each device.
I have tried 32feet library but I can't access RSSI.
Have you a solution or should I migrate to WPF/UWP?
ok, I have found a solution here.
- You first have to install Windows10 development kit.
Then in your project you have to add this library:
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd
Or you can install the "UwpDesktop" NuGet Package.
This works with Console app, Winforms, WPF and UWP.
Here is a simple example:
using Windows.Devices.Bluetooth.Advertisement; namespace BeaconExample { class Program { static void Main(string[] args) { var watcher = new BluetoothLEAdvertisementWatcher(); watcher.Received += Watcher_Received; watcher.Start(); } private static void Watcher_Received(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args) { Console.WriteLine(args.BluetoothAddress.ToString("x") + ";" + args.RawSignalStrengthInDBm); } } }
来源:https://stackoverflow.com/questions/46729280/bluetooth-scan-c-sharp