I would like to access GATT profile from C program using Bluez

1.2k Views Asked by At

I think that it is possible to read / write to the gatt profile using the "hci_send_req" function or the "hci_send_cmd" function. However, we can not find the parameters that set the data. Is it connected to the terminal of BLE and read / write to Gatt profile is not prepared?

Added..2018/11/22 17:06 (JST)

First of all, I investigate whether it can be realized from the command line.

The environment is RaspberryPi3.

pi@raspberrypi:~ $ sudo dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX --type=method_call org.bluez.Device1.Connect
Error org.bluez.Error.Failed: Software caused connection abort

Sorry, please hide the MAC address.

With the gatttool command, connect, primary, char-read-hnd, and char-write-req (cmd) are possible terminals.

Add... 2018/11/22 20:43

Thank you for the information.

I tried, but org.bluez.Adapter1 actually exists, but an error occurs.

pi@raspberrypi:~ $ sudo ./glibtest XX:XX:XX:XX:XX:XX
Adapter is Powered "on"
Unable to get result: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Method "ConnectDevice" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist

The existence of org.bluez.Adapter1 is checked with the following command.

sudo dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0 --type=method_call org.freedesktop.DBus.Introspectable.Introspect
</method></interface><interface name="org.bluez.Adapter1"><method name="StartDiscovery"></method><method name="SetDiscoveryFilter"><arg name="properties" type="a{sv}" direction="in"/>

The version of bluez has been updated from 5.43 to 5.44.

0

There are 0 best solutions below