Skip to contentSkip to conversation

test/example-advertisement: Fix include_tx_power

PATCH Applied Alvar Penning 2 participants 2 messages May 20, 2020 – May 21, 2020 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/example-advertisement: Fix include_tx_power

Adding the Tx Power Level is no longer done via IncludeTxPower, but via the tx-power value in the Includes array. The previous code did not throw an error, but neither led to the insertion of the value. As a result of this change, include_tx_power now adds the Tx Power Level again.

---
 test/example-advertisement | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
test/example-advertisement +3 -3
index f116893b6..96e410683 100755
@@ -57,7 +57,7 @@ class Advertisement(dbus.service.Object):
         self.solicit_uuids = None
         self.service_data = None
         self.local_name = None
-        self.include_tx_power = None
+        self.include_tx_power = False
         self.data = None
         dbus.service.Object.__init__(self, bus, self.path)
 
@@ -78,8 +78,8 @@ class Advertisement(dbus.service.Object):
                                                         signature='sv')
         if self.local_name is not None:
             properties['LocalName'] = dbus.String(self.local_name)
-        if self.include_tx_power is not None:
-            properties['IncludeTxPower'] = dbus.Boolean(self.include_tx_power)
+        if self.include_tx_power:
+            properties['Includes'] = dbus.Array(["tx-power"], signature='s')
 
         if self.data is not None:
             properties['Data'] = dbus.Dictionary(
Signature · 1 line
2.25.4
maintainer Applied
#1 lore raw

Hi Alvar,

Quoted 35 lines · Alvar Penning

Adding the Tx Power Level is no longer done via IncludeTxPower, but via the tx-power value in the Includes array. The previous code did not throw an error, but neither led to the insertion of the value. As a result of this change, include_tx_power now adds the Tx Power Level again.

---
 test/example-advertisement | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
test/example-advertisement +3 -4
index f116893b6..96e410683 100755
@@ -57,7 +57,7 @@ class Advertisement(dbus.service.Object):
         self.solicit_uuids = None
         self.service_data = None
         self.local_name = None
-        self.include_tx_power = None
+        self.include_tx_power = False
         self.data = None
         dbus.service.Object.__init__(self, bus, self.path)
 
@@ -78,8 +78,8 @@ class Advertisement(dbus.service.Object):
                                                         signature='sv')
         if self.local_name is not None:
             properties['LocalName'] = dbus.String(self.local_name)
-        if self.include_tx_power is not None:
-            properties['IncludeTxPower'] = dbus.Boolean(self.include_tx_power)
+        if self.include_tx_power:
+            properties['Includes'] = dbus.Array(["tx-power"], signature='s')
 
         if self.data is not None:
             properties['Data'] = dbus.Dictionary(
--
Quoted 1 line

2.25.4

Applied, thanks.

Signature · 1 line
Luiz Augusto von Dentz