weliem / bluez_inc

A C library for Bluez (BLE) that hides all DBus communication. It doesn't get easier than this. This library can also be used in C++.
MIT License
84 stars 19 forks source link

Register multiple adveritisements #42

Closed Lavenderwh closed 3 months ago

Lavenderwh commented 4 months ago

Hi, I want to say thank you for this great project first. I was able to run my peripheral and central and let them communicate.

Currently my goal is to let my peripheral connect with several centrals at the same time, so I want to register more than one advertisements for the peripheral. But I get registering advertisement failed: An object is already exported for the interface org.bluez.LEAdvertisement1 at /org/bluez/bincadvertisement when I try to register the second one, and I assume that's because the path of the advertisement is hardcoded in the binc_advertisement_create function: https://github.com/weliem/bluez_inc/blob/4f5715dec07688f1ffc35d0b64654c8d40fafdb5/binc/advertisement.c#L161

Would it be possible to add an optional parameter 'path' for this function or add a set_path function in order to enable several advertisements?

weliem commented 3 months ago

Hi, you don't need to register multiple advertisements if you want to allow multiple centrals to connect. Just keep advertising after a connection has been made. The demo apps stops advertising once a central connects, but you can turn that off.

Apart from that I don't it is possible to have multiple advertisements. I think Bluez will merge them into one anyway....