Perform Bluetooth Low Energy GATT client functions
You can perform Bluetooth Low Energy GATT client functions using the GATT submenu options and bluetoothctl commands. These functions include connecting to a remote device and starting or stopping Bluetooth Low Energy GATT scans through the bluetoothctl menu. From the menu gatt submenu, you can retrieve the list of attributes, get attribute information, and select specific attributes. GATT functions also support reading and writing characteristic values, including encrypted characteristics, and reading and writing descriptor values. Additionally, they allow turning notifications on or off for selected attributes.
To stop a Bluetooth Low Energy GATT scan, run the following command from the bluetoothctl menu:
scan off
Sample output
[MyDeviceB]# scan offDiscovery stopped[CHG] Device A4:30:7A:EE:AF:EF RSSI is nil[CHG] Device F8:7D:76:9D:9B:6B RSSI is nil[CHG] Controller 22:22:9B:2C:79:1E Discovering: no
Get the list of attributes
To get the list of attributes of the remote device, run the following command from the menu gatt menu:
list-attributes <bt_address>
Parameters<bt_address> is the address of the remote device.ExampleTo list the attributes of the remote device with the address 6D:38:AF:C6:B5:62, run the following command:
To get the information of an attribute, run the following command from the menu gatt menu:
attribute-info <attribute/UUID>
Parameters<attribute/UUID> is the UUID or the attribute path.ExampleTo get the information of an attribute with the UUID 00002b29-0000-1000-8000-00805f9b34fb, run the following command: