Skip to content

Conversation

@dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Dec 5, 2019

Fixes #35 and #36.

  • Add BLERadio.name, which sets and gets _bleio.Adapter.name
  • Add BLERadio.tx_power, which now is just 0. Setting is not yet implemented (need an Adapter API).
  • Add BLERadio.address_bytes, which gets _bleio.Adapter.address.address_bytes. I didn't want to expose or wrap _bleio.Address, and getting the bytes is the main use case.
  • If no scan_response is supplied to BLERadio.start_advertising(), a default scan response is generated, which contains .name as the COMPLETE_NAME, and .tx_power.

Originally I added an optional argument to .start_advertising() to specify the name. But that doesn't set the name used in the Generic Information Service, and the Bluefruit LE app uses that GIS name in preference to the advertising name, which is confusing. Presumably other apps do this too. So it's good to make the advertising name and the GIS name the same. So the way to use this is:

ble = BLERadio()
ble.name = 'PreferredName'
# ...
ble.start_advertising()

@dhalbert dhalbert requested a review from tannewt December 5, 2019 16:57
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor comment comments but good otherwise. Thanks!

@dhalbert dhalbert requested a review from tannewt December 5, 2019 18:38
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you.

@tannewt tannewt merged commit b67ed5a into adafruit:master Dec 6, 2019
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Dec 9, 2019
Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE to 3.1.0 from 3.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#40 from tannewt/support_magic_light
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#39 from dhalbert/bleradio-name-address
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#38 from tannewt/support_ancs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Advertisements aren't including name

2 participants