Skip to content

start_scan() advertisement_types needs to default to (Advertisement,) #76

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 1 commit into from
Apr 3, 2020

Conversation

dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Apr 3, 2020

Fixes #75.

#72 caused a regression in code that called start_scan() with no advertising_types.
ble_simpletest.py stopped working, for example.

@dhalbert dhalbert requested a review from caternuson April 3, 2020 17:59
@dhalbert dhalbert force-pushed the start_scan-default branch from 8db790f to b08096f Compare April 3, 2020 18:00
@caternuson
Copy link

Looks good. Tested using two CLUEs and these simple test programs:

ADVERTISER:

from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService

ble = BLERadio()
uart_service = UARTService()
advertisement = ProvideServicesAdvertisement(uart_service)
ble._adapter.name = "CLUE_FOO"

ble.start_advertising(advertisement)

while True:
    pass

SCANNER:

from adafruit_ble import BLERadio

ble = BLERadio()
print("scanning")

for advertisement in ble.start_scan():
    print(advertisement.complete_name)

print("scan done")

Previously, the scanner returned nothing. Now it finds and returns the name specified in the advertiser. The None returns are expected for this simple scanner that is not doing any filtering on return type.

Adafruit CircuitPython 5.1.0 on 2020-04-02; Adafruit CLUE nRF52840 Express with nRF52840
>>> import scan
scanning
None
CLUE_FOO
None
CLUE_FOO
None
CLUE_FOO

Also fixes this:
https://forums.adafruit.com/viewtopic.php?f=50&t=164081

@dhalbert dhalbert merged commit 1bffc2b into adafruit:master Apr 3, 2020
@dhalbert dhalbert deleted the start_scan-default branch April 3, 2020 18:38
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Apr 4, 2020
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.

start_scan(): if no Advertisements are given, nothing is returned.
2 participants