-
Notifications
You must be signed in to change notification settings - Fork 115
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
IncludeTxPower is not longer valid since mid 2020 #333
Comments
A link to an archive without advertising: The patch reads as follows:
This appears to be a change introduced in BlueZ 5.47. The possible values for @tnarik: |
I'm currently monkey-patching on my application to get the power. Wasn't sure how you want to handle this. In my case I'm mainly using a Peripheral and then manipulating the Do not have much experience with d-bus (started playing with the whole Bluez, Bluetooth on Pi and D-Bus last Saturday). |
Be interested to see how you are monkey-patching it on your application. I am assuming it is The way for the library to address this is to modify the file https://github.com/ukBaz/python-bluezero/blob/main/bluezero/advertisement.py Ideally the Bluezero advertisement API would stay the same i.e. keep the python-bluezero/bluezero/advertisement.py Lines 149 to 158 in 392a115
It would be the props values that would need to change: python-bluezero/bluezero/advertisement.py Lines 75 to 86 in 392a115
Replace self.props = {
constants.LE_ADVERTISEMENT_IFACE: {
'Type': ad_type,
'ServiceUUIDs': None,
'ManufacturerData': None,
'SolicitUUIDs': None,
'ServiceData': None,
'Includes': set(),
'Appearance': None,
'LocalName': None
}
} And the getter/setter might be: @property
def include_tx_power(self):
"""Include TX power in advert (Different from beacon packet)"""
includes = self.Get(constants.LE_ADVERTISEMENT_IFACE, 'Includes')
return 'tx-power' in includes
@include_tx_power.setter
def include_tx_power(self, state):
if state:
includes = self.props[interface_name]['Includes'].add('tx-power')
else:
includes = self.props[interface_name]['Includes'].remove('tx-power')
return self.Set(constants.LE_ADVERTISEMENT_IFACE, includes) The other thing that looks like it would need to change is the python-bluezero/bluezero/advertisement.py Lines 219 to 220 in 392a115
To maybe: response['Includes'] = dbus.Array(
self.props[interface_name]['Includes'], signature='s') The above is all untested and just me sharing my thoughts. If I don't hear that you are going to do a PR for this, then I'll take a look in a couple of weeks time. |
Had to do this:
But it is also the first time I try to monkey-patch Python. I was not seeing the Regarding the data limit, I am still playing around: put something in, take something out. And configuring several advertisements to check what is possible. |
Let me try to produce a PR during the weekend. |
Yes you are correct, Thanks for having a look at the PR. Happy to help with any issues or questions that arise. |
See:
https://linuxlists.cc/l/15/linux-bluetooth/t/3585256/(patch_bluez)_test_example-advertisement:_fix_include_tx_power
The text was updated successfully, but these errors were encountered: