QUERY · ISSUE
gap_advertise connectable=False doesn't work
port-esp32needs-info
Port, board and/or hardware
esp32-c3 port
MicroPython version
1.26.1
Reproduction
Setup:
https://github.com/rroemhild/ubeacon/blob/main/examples/eddystone_uid.py
Expected behaviour
not visible/advertised as connectable
Observed behaviour
Advertised as connectable. Tested with a smartphone and a laptop.
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree
CANDIDATE · ISSUE
ESP32 BLE gap_advertise() param cause exception
port-esp32extmod
According to BLE.gap_advertise(), I'm setting up the param 'connectable' to False, then it will cause exception:
import ubluetooth as bt
from ble_advertising import beacon_advertising_payload
class Beacon(object):
def __init__(self, ble):
self.__ble = ble
self.__ble.active(False)
print("activating ble...")
self.__ble.active(True)
print("ble activated")
self.__adv_payload = beacon_advertising_payload("https://walkline.wang")
def advertise(self, interval_us=50000):
print("advertising...")
self.__ble.gap_advertise(interval_us, adv_data=self.__adv_payload, connectable=False)
def main():
ble = bt.BLE()
beacon = Beacon(ble)
beacon.advertise()
activating ble...
I (21110) BTDM_INIT: BT controller compile version [5aed448]
I (42562) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (42662) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0
GAP procedure initiated: stop advertising.
ble activated
advertising...
GAP procedure initiated: advertise; disc_mode=2 adv_channel_map=7 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=80 adv_itvl_max=80
GAP procedure initiated: advertise; disc_mode=2 adv_channel_map=7 own_addr_type=2 adv_filter_policy=0 adv_itvl_min=80 adv_itvl_max=80
Traceback (most recent call last):
File "<stdin>", line 64, in <module>
File "<stdin>", line 60, in main
File "<stdin>", line 53, in advertise
OSError: [Errno 5] EIO
According to the system information prompt, it looks like the advertise function was executed twice automatically, but why?