Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

adafruit_ble start_advertising() timeout arg err, raspberry
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

adafruit_ble start_advertising() timeout arg err, raspberry

by erahani on Wed Sep 23, 2020 2:52 am

I run this code on raspberry pi and got this error. I appreciate help how to resolve it.

error:

timeout=0 if timeout is None else timeout,

TypeError: start_advertising() got an unexpected keyword argument 'timeout'

code:

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)

while True:
ble.start_advertising(advertisement)
while not ble.connected:
pass
while ble.connected:
pass


*my finidngs: I digged into the library below:
https://github.com/adafruit/Adafruit_Ci ... _init__.py

in raspberry pi sys.implementation.name return "cpython"
so in line 194 calls:
self._adapter.start_advertising(
advertisement_bytes,
scan_response=scan_response_bytes,
connectable=advertisement.connectable,
interval=interval,
timeout=0 if timeout is None else timeout,
)

the bleio.adapter.start_advertising function does not have timeout argument!!! (see https://github.com/adafruit/Adafruit_Bl ... dapter_.py)

erahani
 
Posts: 4
Joined: Wed Sep 23, 2020 2:44 am

Re: adafruit_ble start_advertising() timeout arg err, raspbe

by tannewt on Wed Sep 23, 2020 11:54 am

What is the full backtrace for the error? It looks like the top level library does have advertising.

tannewt
 
Posts: 1853
Joined: Thu Oct 06, 2016 8:48 pm

Re: adafruit_ble start_advertising() timeout arg err, raspbe

by erahani on Wed Sep 23, 2020 8:42 pm

The question is: is adafruit_ble for CircuitPython only? is CircuitPython different from Regular Python?

erahani
 
Posts: 4
Joined: Wed Sep 23, 2020 2:44 am

Re: adafruit_ble start_advertising() timeout arg err, raspbe

by tannewt on Thu Sep 24, 2020 2:19 pm

adafruit_ble should work on full OSes via Adafruit_Blinka_BLE which provides _bleio APIs on top of bleak.

And yes, CircuitPython is different from regular Python (typically referred to as CPython as in it's implemented with C.)

tannewt
 
Posts: 1853
Joined: Thu Oct 06, 2016 8:48 pm

Re: adafruit_ble start_advertising() timeout arg err, raspbe

by erahani on Fri Sep 25, 2020 3:06 am

I want to run Adafruit_CircuitPython_BLE on Raspberry regular python. How can I fix that error?

erahani
 
Posts: 4
Joined: Wed Sep 23, 2020 2:44 am

Re: adafruit_ble start_advertising() timeout arg err, raspbe

by tannewt on Fri Sep 25, 2020 1:42 pm

We don't support peripheral (start_advertising) on raspberry pi: https://github.com/adafruit/Adafruit_Bl ... #L152-L160

We only support the Central role which involves listening to advertisements and initiating a connection.

tannewt
 
Posts: 1853
Joined: Thu Oct 06, 2016 8:48 pm

Re: adafruit_ble start_advertising() timeout arg err, raspbe

by erahani on Fri Sep 25, 2020 5:31 pm

thanks for clarification. do you know any solution or recommendation for other packages that support peripheral(advertising) on raspberry pi?
Thanks

erahani
 
Posts: 4
Joined: Wed Sep 23, 2020 2:44 am

Re: adafruit_ble start_advertising() timeout arg err, raspbe

by tannewt on Mon Sep 28, 2020 5:12 pm

I don't know of any. Sorry!

tannewt
 
Posts: 1853
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.