Which tool has replaced gatttool in bluez5?
update
ArchWiki listed gatttool
as deprecated and lists btgatt-client
the D-Bus Gatt API as replacement.
gattlib from labapart supports bluez
5 and provides gatttool
.
I guess gatttool got deprecated due to a missing maintainer rather than being replaced by some new tool.
edit
unfortunately the code for gatttool in the linked repository supports only bluez 4.
Cannot Read HM-10 After Connecting with Bluez
btmon logs show that the data coming from your HM-10 device are in the form of notifications. In BLE you have three ways to data transfer; read, write and notify. Read is that a GATT client (in your case Bluez) reads data from a service characteristic or from service descriptor of GATT server, provided that read operation is permitted on those respective characteristic or descriptor. Write operation is that a GATT client sends data to GATT server (HM-10) by writing to its service characteristic or descriptor.
The only way by which GATT server sends data to GATT client by itself is by notifications. But the GATT client need to enable notifications on GATT server after establishing connection. Enabling notification can be done by writing to Client Characteristic Configuration Descriptors (CCC) of GATT server. CCC is a special GATT service defined in Bluetooth Core specs.
Once notifications are enabled you will see data from GATT server. With Bluez you can do all BLE operations using gatttool. Below is a example:
For example if the Bluetooth device address of HM-10 is 03:0F:45:65:43:FF and your device hci interface address is hci0, below sequence of commands enables notifications:
gatttool -i hci0 -b 03:0F:45:65:43:FF -I
[03:0F:45:65:43:FF][LE]>connect
Attempting to connect to 03:0F:45:65:43:FF
Connection successful
# lists all other primary services
[03:0F:45:65:43:FF][LE]> primary
attr handle: 0x0001, end grp handle: 0x0005 uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x0006, end grp handle: 0x0009 uuid: 00001801-0000-1000-8000-00805f9b34fb
# lists all characteristics
[03:0F:45:65:43:FF][LE]> characteristics
handle: 0x0002, char properties: 0x02, char value handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0004, char properties: 0x02, char value handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb
# 2902 is UUID of CCC service
[03:0F:45:65:43:FF][LE]> char-read-uuid 2902
handle: 0x0009 value: 00 00
handle: 0x0019 value: 00 00
# Enable notifications
[03:0F:45:65:43:FF][LE]> char-write-req 0x0009 0100
Characteristic value was written successfully
[03:0F:45:65:43:FF][LE]> char-write-req 0x0019 0100
Characteristic value was written successfully
hcitool lescan does not work on Bluetooth version 5
gatttool and hcitool were both deprecated back in 2017.
D-Bus API is documented at: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc
And there are examples at: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test.
For exploration on the command line then either btmgmt
or bluetoothctl
should cover most situations.
Related Topics
Shell: What Is The Purpose of ${Var:-} When Var Is Unset or Null
Container Running in Privileged Mode
How to Run The Linux/X86/Shell_Bind_Tcp Payload Stand Alone
Why Are Several Signal Numbers Architecture-Dependent on Linux
Succinct Way to Print All Lines Up Until The Last Line That Matches a Given Pattern
How to Read The Password from The Text File in Perl
Why 2 Linux Processes of Same File Cannot Share Text Segment
Google Suggest Query Using Curl
How to Use Multiple Threads for Zlib Compression (Same Input Source)
How to Reserve Ip When Provisioning Azure Vm (Resource Manager)
What Happens When I Sudo Bash -C
Passwd in One Command Isn't Working
Understanding Linux Display Variable
Linux - Get Text from Second Tab