DTynewydd
DTynewydd

Reputation: 426

Detecting bluetooth signal strength from RSSI on Windows

I'm trying to understand how I might access the RSSI of a Bluetooth (not LE) connection in either C# or C++ on Windows.

My understanding is that there is no straightforward "GetRSSI()" type command but is there any indirect way to access it?

Everything I've found so far seems to be aimed at LE connections.

Edit: I've had a look into AEPs and tried to get the SignalStrength AEP from a connected BT device.

    foreach (var key in deviceInformation.Properties.Keys)
    {
        Debug.WriteLine($"{key}: {deviceInformation.Properties.GetValueOrDefault(key)}");
    }

Gives:

System.ItemNameDisplay: <ommitted>

System.Devices.DeviceInstanceId: 
System.Devices.Icon: C:\Windows\System32\DDORes.dll,-2001
System.Devices.GlyphIcon: C:\Windows\System32\DDORes.dll,-3001
System.Devices.InterfaceEnabled: 
System.Devices.IsDefault: 
System.Devices.PhysicalDeviceLocation: 
System.Devices.ContainerId: 

With the item name omitted by me.

So it looks like there are no AEPs, unless I'm missing something?

Upvotes: 3

Views: 5027

Answers (1)

Devi
Devi

Reputation: 21

I know this is late, but I just started a new project where I also want information about the SignalStrength for Bluetooth (not LE) devices.

@Mike-Petrichenko was giving you some good hints. After following his advice of searching for "System.Devices.Aep.SignalStrength" I found this post.

After going through the OP's Code and debugging a little, I came up with this solution:

private const string SignalStrengthProperty = "System.Devices.Aep.SignalStrength";
var additionalProperties = new[] { SignalStrengthProperty };

DeviceWatcher mWatcher = DeviceInformation.CreateWatcher(BluetoothDevice.GetDeviceSelector(), additionalProperties);
var rssi = Convert.ToInt16(deviceInformation.Properties[SignalStrengthProperty]);

Upvotes: 2

Related Questions