Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux] Fix BLE infinite advertising #32211

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/platform/Linux/bluez/BluezAdvertisement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ BluezLEAdvertisement1 * BluezAdvertisement::CreateLEAdvertisement()
// Bluez to set "BR/EDR Not Supported" flag. Bluez doesn't provide API to do that explicitly
// and the flag is necessary to force using LE transport.
bluez_leadvertisement1_set_discoverable(adv, TRUE);
bluez_leadvertisement1_set_discoverable_timeout(adv, 0 /* infinite */);
// empty discoverable timeout for infinite discoverability

// empty includes
bluez_leadvertisement1_set_local_name(adv, mAdvName);
Expand Down
42 changes: 39 additions & 3 deletions src/platform/Linux/dbus/bluez/DbusBluez.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,21 @@
</method>
</interface>

<!--
This interface shall be exported by Matter GATT application and registered
with org.bluez.GattManager1.RegisterApplication method.
-->
<interface name="org.bluez.GattService1">
<property name="UUID" type="s" access="read" />
<property name="Device" type="o" access="read" />
<property name="Primary" type="b" access="read" />
<!-- <property name="Includes" type="ao" access="read" /> -->
</interface>

<!--
This interface shall be exported by Matter GATT application and linked
with org.bluez.GattService1 object via the Service property.
-->
<interface name="org.bluez.GattCharacteristic1">
<method name="ReadValue">
<arg name="options" type="a{sv}" direction="in"/>
Expand Down Expand Up @@ -152,6 +160,10 @@
<property name="NotifyAcquired" type="b" access="read" />
</interface>

<!--
This interface shall be exported by Matter GATT application and linked
with org.bluez.GattCharacteristic1 object via the Characteristic property.
-->
<interface name="org.bluez.GattDescriptor1">
<method name="ReadValue">
<arg name="options" type="a{sv}" direction="in"/>
Expand All @@ -172,6 +184,10 @@
</property>
</interface>

<!--
This interface shall be exported by Matter GATT application and registered
with org.bluez.LEAdvertisingManager1.RegisterAdvertisement method.
-->
<interface name="org.bluez.LEAdvertisement1">
<method name="Release"/>
<property name="Type" type="s" access="read"/>
Expand All @@ -183,13 +199,33 @@
<property name="ServiceData" type="a{sv}" access="read"/>
<property name="Data" type="a{yay}" access="read"/>
<property name="Discoverable" type="b" access="read"/>
<!--
Do not expose discoverable timeout property, so BlueZ will set it
internally to zero, effectively disabling the timeout. Becase of BlueZ
bug, which is not fixed until BlueZ 5.73, exposing discoverable timeout
as zero will timout the advertisement immediately.

<property name="DiscoverableTimeout" type="q" access="read"/>
-->
<property name="Includes" type="as" access="read"/>
<property name="LocalName" type="s" access="read"/>
<property name="Appearance" type="q" access="read"/>
<!-- <property name="Duration" type="q" access="read"/> -->
<!-- <property name="Timeout" type="q" access="read"/> -->
<!-- <property name="SecondaryChannel" type="s" access="read"/> -->
<!--
Do not expose duration, so BlueZ will use the internal default value.

<property name="Duration" type="q" access="read"/>
-->
<!--
Do not expose timeout property, so BlueZ will not call the Release()
method after a timeout.

<property name="Timeout" type="q" access="read"/>
-->
<!--
We are not using SecondaryChannel property, so we do not expose it.

<property name="SecondaryChannel" type="s" access="read"/>
-->
<property name="MinInterval" type="u" access="read"/>
<property name="MaxInterval" type="u" access="read"/>
</interface>
Expand Down
Loading