Re: Request for help on using BlueZ in C app for a custom GATT server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rafał,

On Thu, Jul 4, 2019 at 5:00 PM Rafał Miłecki <zajec5@xxxxxxxxx> wrote:
>
> Hi,
>
> I'm trying to figure out how to register a custom profile + service(s)
> using BlueZ in my C app.
>
> I found some posts mentioning gatt_service_add() and suggesting to
> look at gatt-example.c. I checked that file and it seems to be part of
> "plugins" with BLUETOOTH_PLUGIN_DEFINE in it.
> In "Doing Bluetooth Low Energy on Linux" pdf I read that plugins are
> deprecated and I should focus on D-Bus API.
> Is that correct? Should I avoid gatt_service_add()?
>
> Looking further I found
> https://people.csail.mit.edu/albert/bluez-intro/c404.html
> This example seems to be using hci_* functions (like hci_get_route()
> and hci_inquiry()) from libbluetooth.so. I checked hci_lib.h and found
> nothing related to registering profiles/services.
> What exactly is libbluetooth? Is that for GATT client purposes only?
>
> Finally I started looking for D-Bus API info.
> In "Doing Bluetooth Low Energy on Linux" pdf there is a
> RegisterApplication() mentioned. I can see that also in
> doc/gatt-api.txt.
> Is that the new D-Bus API I read about? Is there some tutorial/example
> for it I could use?

You should use the D-Bus API the documentation is here:

https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt

You can use as example what bluetoothctl does to register services:

https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/client/gatt.c

-- 
Luiz Augusto von Dentz




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux