-
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
How to show Txpower in advertisement data #409
Comments
As discussed in #333, Bluezero does not support the inclusion of tx_power in advertisement since the change to the BlueZ API. There was no PR created at the end of that issue so this library does not have the update. What are you trying to do? |
Thank you for your prompt reply. And my code is modified from the ble_uart.py. And, I didn't get the error messages. |
And how have you modified it to include the TX power? |
Oh, not yet. |
Can you check that busctl get-property org.bluez /org/bluez/hci0 org.bluez.LEAdvertisingManager1 SupportedIncludes Do you get:
|
YES! And, I also reference this #323. I thought this proble is similar with mine. However, I add ble_uart.advert.IncludeTxPower = 'True' in my code, the operation did not result in any action. |
You are correct, it only means that those values can be added to the advert. What #333 is discussing is that the BlueZ API was changed and that Bluezero hasn't been updated to reflect that. So the change you made to your code won't work unless the library is updated. |
To include some information here on how the BlueZ API has changed. In the 5.45 release This is documented at: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt?h=5.45#n64
In more recent versions of the API how This is documented at: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/org.bluez.LEAdvertisement.rst?h=5.73#n123
For reference,
This is the change that needs to be reflected in Bluezero. |
I've created a feature branch where I've made the code changes: The code I used to test this was: from bluezero import advertisement
from bluezero import constants
advert_id = 1
ad_type = 'broadcast'
ad_mngr_options = {}
beacon = advertisement.Advertisement(advert_id, ad_type)
beacon.include_tx_power = True
print(beacon.GetAll(constants.LE_ADVERTISEMENT_IFACE))
beacon.local_name = "MyBeacon"
beacon.service_UUIDs = ['FEAA']
beacon.service_data = {'FEAA': [0x10, 0x08, 0x03, 0x75, 0x6B, 0x42, 0x61, 0x7A, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2E, 0x69, 0x6F]}
ad_manager = advertisement.AdvertisingManager()
ad_manager.register_advertisement(beacon, ad_mngr_options)
beacon.start() In nRF Connect app on the phone I scanned for the beacon. With the With the This looks to be what you are expecting @21317389 ? |
II'm really grateful for your help, and I think I'll run some tests after I finish my work . Thank you so much for your assistance. |
Added the 0.9.0 release to PyPI that contains this fix |
HELLO,
I can't set the TXPOWER in advertisement.
How to solve it, and I think maybe #333 can solve me problem.
But I can't understand how to fix.
Sincerely.
The text was updated successfully, but these errors were encountered: