简体   繁体   English

在 Windows 上从 RSSI 检测蓝牙信号强度

[英]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.我试图了解如何在 Windows 上使用 C# 或 C++ 访问蓝牙(非 LE)连接的 RSSI。

My understanding is that there is no straightforward "GetRSSI()" type command but is there any indirect way to access it?我的理解是没有直接的“GetRSSI()”类型命令,但是有没有间接的方法来访问它?

Everything I've found so far seems to be aimed at LE connections.到目前为止,我发现的所有内容似乎都是针对 LE 连接的。

Edit: I've had a look into AEPs and tried to get the SignalStrength AEP from a connected BT device.编辑:我查看了 AEP 并尝试从连接的 BT 设备获取 SignalStrength AEP。

    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?所以看起来没有 AEP,除非我遗漏了什么?

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.我知道这已经晚了,但我刚刚开始了一个新项目,我还需要有关蓝牙(非 LE)设备的 SignalStrength 的信息。

@Mike-Petrichenko was giving you some good hints. @Mike-Petrichenko 给了你一些很好的提示。 After following his advice of searching for "System.Devices.Aep.SignalStrength" I found this post按照他搜索“System.Devices.Aep.SignalStrength”的建议后,我找到了这篇文章

After going throw the OPs Code and debugging a little, I came up with this solution:在抛出 OPs 代码并稍微调试之后,我想出了这个解决方案:

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]);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM