Skip to content

Easier specification of prefixes; fixes for use with bleak #89

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

Merged
merged 9 commits into from
Jun 16, 2020

Conversation

dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Jun 10, 2020

  • Advertisement-matching prefixes are now specified as tuples of prefixes. You no longer need to count up the bytes and include a length byte in front of each subprefix. The class attribute has been renamed from prefix to match_prefixes. This is an incompatible change; a few other libraries will need to change also. PR's will be opened for those libraries.
  • All the definitions of __get__(self, obj, cls) now check for obj is None, and return self in that case. This is because MicroPython/CircuitPython don't invoke descriptor protocol on obj's class, but CPython does. So to be uniform, when running in CPython, check for this case and just return the actual object.
  • Catch when microcontroller is not present, such as when running in CPython.
  • Windows doesn't have os.uname(), so catch that.
  • Make it easier and clearer for an Advertisement subclass to change the behavior of matches() from all to any, by providing a match_prefixes(cls, entry, all_=True) class method to call. Note that the arg is called all_, because it otherwise conflicts with the builtin function all(). See _bleio.ScanEntry.matches(..., all=) keyword arg conflicts with all() circuitpython#3007 for a related issue.
  • Improve printed representation of some classes.

Fixes #82.

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.

Just a couple comments. Thanks!

@dhalbert dhalbert requested a review from tannewt June 12, 2020 19:20
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.

Ok, thanks!

@tannewt tannewt merged commit 7dcb774 into adafruit:master Jun 16, 2020
@dhalbert dhalbert deleted the easier-prefixes branch June 16, 2020 19:48
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jun 19, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_APDS9960 to 2.2.0 from 2.1.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_APDS9960#26 from FoamyGuy/rotation_modifier

Updating https://github.com/adafruit/Adafruit_CircuitPython_LIS3MDL to 1.1.3 from 1.1.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_LIS3MDL#10 from kattni/combo-example

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE to 7.0.0 from 6.1.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#89 from dhalbert/easier-prefixes

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_BroadcastNet to 0.10.0 from 0.9.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE_BroadcastNet#10 from dhalbert/match_prefixes

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio to 0.3.0 from 0.2.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE_Radio#12 from dhalbert/match_prefixes
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE_Radio#10 from adafruit/add-build-yml

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_Adafruit to 1.1.0 from 1.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE_Adafruit#4 from dhalbert/match-prefix

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_Eddystone to 0.10.0 from 0.9.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE_Eddystone#8 from dhalbert/match_prefixes
  > build.yml: add black formatting check

Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 2.7.1 from 2.7.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#51 from caternuson/iss50
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.

prefix building
2 participants