Skip to content

Advertisement Names #164

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

Open
MadGeometer opened this issue May 14, 2022 · 3 comments
Open

Advertisement Names #164

MadGeometer opened this issue May 14, 2022 · 3 comments

Comments

@MadGeometer
Copy link

MadGeometer commented May 14, 2022

Hello,

The advertisements returned by ble.start_scan() are missing short_name and complete_name. This happens in the ble_simpletest.py and ble_detailed_scan.py in the examples folder. Setting extended=true and increasing buffer_size doesn't help.

Any ideas?

Thanks,
Mike

CircuitPython Info:

Adafruit CircuitPython 7.3.0-beta.2-6-gbf0e1fafa on 2022-05-02; Adafruit QT Py ESP32-S3 no psram with ESP32S3
Board ID:adafruit_qtpy_esp32s3_nopsram

Sample code:

from adafruit_ble import BLERadio

ble = BLERadio()

print("Beginning Scan")
foundAddresses = set()

for adv in ble.start_scan(extended=True, buffer_size=2048, timeout=5):
    addr = adv.address
    if addr not in foundAddresses:
        foundAddresses.add(addr)
        print(adv.short_name, adv.complete_name, adv.address, adv.connectable, adv.rssi, adv.appearance,  adv.scan_response)

ble.stop_scan()
print("Scan Complete")

Output:

Beginning Scan
None None <Address 57:9e:15:aa:10:4b> True -68 None True
None None <Address 41:4a:36:7d:08:3c> True -72 None True
None None <Address d6:0c:88:89:3b:55> False -65 None False
Scan Complete
@tannewt
Copy link
Member

tannewt commented May 16, 2022

Are you sure the devices you are scanning advertises them? Using nRF connect on your phone is a good comparison.

@MadGeometer
Copy link
Author

Yes, the devices (one Macbook Pro, one iPad, and one iPhone) are indeed broadcasting their names. In fact, the names are displayed in Bluefruit Connect and nRF Connect, but not in the output from the sample code.

@tannewt
Copy link
Member

tannewt commented May 17, 2022

I'd recommend printing all of the advertisements. CircuitPython doesn't join the advertisement with scan response so you are at least missing half of the first two. IIRC you can print the raw advertisement with bytes(adv) too.

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

No branches or pull requests

2 participants