I'm new in programming Bluetooth low energy using BlueZ.
I want to develop a native code c to scan nearby devices using a BlueZ API for Bluetooth low energy on Intel Edison. I've seen this question, but the answer doesn't really help. Any advice?
I'm new in programming Bluetooth low energy using BlueZ.
I want to develop a native code c to scan nearby devices using a BlueZ API for Bluetooth low energy on Intel Edison. I've seen this question, but the answer doesn't really help. Any advice?
BLE programming with BlueZ on Galileo or Edison is similar to any other x86 platform.
Edison (and Galileo) usually comes with BlueZ libraries pre-installed. You just need to link with them with your C code, and program similar to other x86 platform.
For a full C code example bluetooth scan with BlueZ, see this link.
Please see this example for BLE scan
And the HCI API here.
hci_le_set_scan_parameter
, please see this example for BLE scan –
Tletski The example on the other answer does not work for me, it stops in Scanning...
The next link 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
BLE programming with BlueZ on Galileo or Edison is similar to any other x86 platform.
Edison (and Galileo) usually comes with BlueZ libraries pre-installed. You just need to link with them with your C code, and program similar to other x86 platform.
For a full C code example bluetooth scan with BlueZ, see this link.
Please see this example for BLE scan
And the HCI API here.
hci_le_set_scan_parameter
, please see this example for BLE scan –
Tletski The GattLib library (which was created after this question was asked) has the tools to scan/connect to BLE devices using C.
The intel-edison scan.c code also works on Raspberry Pi.
It works to scan for the Adafruit BLE UART friend module connected to the arduino Uno.
On the Pi, need to download the bluez-5.33.tar.gz, libncurses-dev and the libbluetooth-dev.
To compile scan.c, use
gcc scan.c -lbluetooth -o scan
© 2022 - 2024 — McMap. All rights reserved.