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
Thank You
Ok sorry for the other answer...
This works for c language, but has an error when casting the bytes that have the information about de rssi signal. https://github.com/glock45/intel-edison-playground/blob/master/scan.c
this line 121: printf("%s - RSSI %d\n", addr, (char)info->data[info->length]);
should be: printf("%s - RSSI %d\n", addr, (int8_t)info->data[info->length]);
i found these by looking inside bluez-version/monitor/*.c, where btmon program is. You can see the data types and structs, hcidump.c is very useful and packets.c, and main.c too, but there are many to learn about the hci sockets
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:
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.
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:
The results displayed on the monitor should be similar to this:
Note that when using btmon you do not have to connect to get the rssi of a BLE device.
I hope this helps.
You can use a combination of: sudo hcitool lescan --duplicates & ; sudo hcidump --raw
that will provide you the raw dump of all the bluetooth packets which contain all relevant information you must be interested in such as : UUID, Major, Minor, RSSI, TxPower. You will have to run some kind of script to parse and filter LE packets and make them into readable form.
One of the scripts written with Bash and S editor was provided by jjnebaker here with the problem and solution discussed here
The Other option is to use PyBluez using the example code here But you might find the solution provided by Switchdoc labs useful according to your needs as well. here
I also found a program I was able to edit to do what I wanted as well I through it up on my github account https://github.com/tholum/bluez/blob/master/blue.py
try :
$ bluez-test-discovery
output :
gives you : RSSI = -65