Skip to content

extmod/modbluetooth: Add support for changing the GAP device name. #6019

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
May 11, 2020

Conversation

dpgeorge
Copy link
Member

@dpgeorge dpgeorge commented May 8, 2020

The GAP device name of a BLE device is currently hard-coded. This PR allows the user to dynamically set/get the GAP device name used by service 0x1800, characteristic 0x2a00. The usage is:

BLE.config(gap_name="myname")
print(BLE.config("gap_name"))

This name appears, for example, when a phone reads characteristic 0x2a00 of a peripheral that it scans/connects to.

The name can be any string of bytes (including an interior null byte on the BTstack implementation), although the BLE spec specifies it should be UTF-8.

Docs and test are included here.

@dpgeorge dpgeorge added the extmod Relates to extmod/ directory in source label May 8, 2020
@Walkline80
Copy link

That's a great job!~

@jimmo
Copy link
Member

jimmo commented May 11, 2020

Thanks!!

This commit allows the user to set/get the GAP device name used by service
0x1800, characteristic 0x2a00.  The usage is:

    BLE.config(gap_name="myname")
    print(BLE.config("gap_name"))

As part of this change the compile-time setting
MICROPY_PY_BLUETOOTH_DEFAULT_NAME is renamed to
MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME to emphasise its link to GAP and this
new "gap_name" config value.  And the default value of this for the NimBLE
bindings is changed from "PYBD" to "MPY NIMBLE" to be more generic.
@dpgeorge dpgeorge force-pushed the extmod-bluetooth-gap-name branch from 390b033 to 3b6c911 Compare May 11, 2020 11:32
@dpgeorge dpgeorge merged commit 3b6c911 into micropython:master May 11, 2020
@dpgeorge dpgeorge deleted the extmod-bluetooth-gap-name branch May 11, 2020 11:53
@jimmo jimmo mentioned this pull request Jun 8, 2020
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extmod Relates to extmod/ directory in source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy