蓝牙信号强度
有谁知道如何在 C# 中最好地跟踪蓝牙连接的信号强度?
我正在考虑使用 WMI 查询,但无法追踪封装连接的 WMI 类。
这个想法是,当我把手机放在口袋里离开机器时,蓝牙信号会减弱,我的机器会锁定,我不会被攻击。
Does anyone have any idea how to track the signal strength of a bluetooth connection perferably in C#?
I was thinking using a WMI query but couldn't track down the WMI class encapsulating the connection.
The idea is when I leave my machine with my cellphone in pocket the bluetooth signal weakens and my machine locks and I don't get goated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
蓝牙设备中运行的链路管理协议 (LMP) 负责链路设置和配置。 这一切都是通过两个设备交换协议数据单元 (PDU) 来完成的。RSSI 的硬件和软件功能在 LMP 级别提供,允许您管理 RSSI 数据。 它允许您读取 RSSI 电平并控制 TX RF 输出功率(LMP 功率命令)LMP 进行控制并获取状态信息。
因此,当使用 MS 蓝牙堆栈时,您实际要查找的内容是在 LMP 中定义的。
MS 蓝牙堆栈 HCI 接口已支持以下功能,即
HCI_READHCIPARAMETERS
HCI_START硬件
HCI_STOPHARDWARE
HCI_SETCALLBACK
HCI_OPENCONNECTION
HCI_READPACKET
HCI_WRITEPACKET
HCI_CLOSECONNECTION
我想微软可以实现一个名为 HCI_Read_RSSI 的函数,但他们没有。
要获取 RSSI 数据,您必须使用 LMP 来获取所需的信息。
读取 RSSI 数据的伪代码示例
这仅适用于 Microsoft 蓝牙堆栈。 这也是 C++ 代码。 我从页面底部的专家交流帖子(我知道)中得到了这个。
http://www.experts-exchange.com/Programming/Wireless_Programming/Bluetooth /Q_21267430.html
没有特定的函数可以为您完成此操作。
还有一个库可以帮助您,我还没有完全浏览文档,但我听说过有关它的好消息。
http://inthehand.com/content/32feet.aspx
祝你好运!
The Link Manager Protocol (LMP) running in a Bluetooth device looks after the link setup and configuration. This is all done by two devices exchanging Protocol Data Units (PDUs).The hardware and software functionality of the RSSI is provided at the LMP level that permits you to manage the RSSI Data. It allows you to read the RSSI level and control the TX RF output power (the LMP power commands) LMP for control and to get at status information.
So what you are actually looking for is defined in the LMP when using the MS Bluetooth stack.
The MS Bluetooth Stack HCI interface already supports functions below i.e
HCI_READHCIPARAMETERS
HCI_STARTHARDWARE
HCI_STOPHARDWARE
HCI_SETCALLBACK
HCI_OPENCONNECTION
HCI_READPACKET
HCI_WRITEPACKET
HCI_CLOSECONNECTION
I suppose microsoft could have implemented a function called HCI_Read_RSSI but they didn't.
To obtain the the RSSI data you will have to use the LMP to get the info you need.
Example psuedocode to read RSSI Data
This will ONLY work with the Microsoft bluetooth stack. This is C++ code also. I got this from the experts exchange post(I know) at the bottom of the page.
http://www.experts-exchange.com/Programming/Wireless_Programming/Bluetooth/Q_21267430.html
There is no specific function that does it for you.
Also there is this library that may help you, I haven't looked through the documentation completely but I've heard good things about it.
http://inthehand.com/content/32feet.aspx
Goodluck man!