蓝牙LE信号强度Linux [英] Bluetooth LE Signal Strength Linux

查看:267
本文介绍了蓝牙LE信号强度Linux的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,有什么方法可以使Linux中的蓝牙设备获得接近的信号强度吗?或任何适用于nodejs,php或mono的好的库(我确实知道一些c ++或python,但宁愿不使用它们)如果工具不存在但相当容易编写

Hello is there any way to get the signal strength of near by bluetooth le devises in linux? Or any good libraries for nodejs, php or mono ( I do know some c++ or python but would prefer to say away from them ) if a tool does not exsist but would be fairly easy to write

谢谢

推荐答案

在Linux上,使用hcitool命令可以实现此目的.但是,必须连接才能获得设备的rssi.如果要从命令行实现此目标,请尝试:

On Linux, the way to do this is with the hcitool command. However, you have to be connected to get the rssi of a device. If you want to achieve this from the command line, try:

#hcitool rssi AA:BB:CC:DD:EE:FF

如果您想查看实现此目标的实际C代码,请查看bluez 工具/hcitool.c 文件,位于cmd_rssi函数下.

If you want to see the actual C code to achieve this, take a look at the bluez tools/hcitool.c file, under the cmd_rssi function.

static void cmd_rssi(int dev_id, int argc, char **argv)
{
    ...
}


对于低功耗蓝牙,我只知道一种方法,那就是使用#btmon命令.在后台运行btmon,然后扫描低功耗蓝牙设备:


For Bluetooth Low Energy, I only know one way to do this, and that is using the #btmon command. Run btmon in the background then scan for Bluetooth Low Energy devices:

#./btmon &
# hcitool lescan

监视器上显示的结果应与此类似:

The results displayed on the monitor should be similar to this:

> HCI Event: LE Meta Event (0x3e) plen 12                                                                                  
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: AA:BB:CC:DD:EE:FF (<Vendor Name>)
        Data length: 0
        ***RSSI: -34 dBm (0xde)***
AA:BB:CC:DD:EE:FF <Device Name>

请注意,使用btmon时,无需连接即可获取BLE设备的rssi.

Note that when using btmon you do not have to connect to get the rssi of a BLE device.

我希望这会有所帮助.

这篇关于蓝牙LE信号强度Linux的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆