在 adafruit_ble 中更改 Circuit Playground Bluefruit 的广告 ID

问题描述 投票:0回答:1

不确定这个问题有多深奥,但我正在尝试使用 Circuit Python 从 Adafruit Circuit Playground Bluefruit 进行一些基本的蓝牙通信。

基本用例是使用 UART 与计算机传输数据以进行演示,但问题是附近大约有 30 个设备,因此没有人知道“哪个”是他们的设备.

有没有办法更改设备蓝牙中的显示名称/广告ID?我在此处或此处的示例中看到了

short_name
complete_name
的参考资料,但是大多数情况下尝试这些似乎没有任何作用。

这是基本示例 - 我试图查看库的源代码,但我找不到与广告名称相关的任何内容。我原以为这会是微不足道的,尽管我似乎找不到任何地方可以改变它。

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

ble = BLERadio()
uart = UARTService()
advertisement = ProvideServicesAdvertisement(uart)
advertisement.complete_name = "custom name" # had hoped this would work

ble.start_advertising(advertisement)
while True:
    # Normally other work would be done here after connecting.
    pass        
bluetooth-lowenergy adafruit adafruit-circuitpython
1个回答
0
投票

您所需要做的就是设置

ble.name = "new advertising ID"
,由 John Park 转交:https://www.youtube.com/watch?v=nS10NxHRrXE

© www.soinside.com 2019 - 2024. All rights reserved.