adafruit / Adafruit_Blinka_bleio

`_bleio` for Blinka based on `bleak`
58 stars 19 forks source link

got an unexpected keyword argument 'timeout' #25

Closed arslan437 closed 4 years ago

arslan437 commented 4 years ago

I am using rapberry 4


pi@raspberrypi:~/tcodes/Adafruit_CircuitPython_BLE/examples $ python ble_current_time_service.py
Traceback (most recent call last):
  File "ble_current_time_service.py", line 15, in <module>
    radio.start_advertising(a)
  File "/home/pi/.local/lib/python3.7/site-packages/adafruit_ble/__init__.py", line 212, in start_advertising
    timeout=0 if timeout is None else timeout,
TypeError: start_advertising() got an unexpected keyword argument 'timeout'
jpeponis commented 4 years ago

I got this as well.

dhalbert commented 4 years ago

This error is actually in https://github.com/adafruit/Adafruit_Blinka_bleio: transferred issue to there.

It's true that the signature of Adapter.start_advertising() is incorrect: it should have an optional timeout parameter in the code below. I will fix that - thanks for finding it. However, Adafruit_Blinka_bleio only implements BLE Central mode, so If the call happened, you'd discover that it will throw NotImplementedError, because advertising is not supported. So unfortunately you can't use Adafruit_Blinka_bleio to get the time from an iPhone, etc.

https://github.com/adafruit/Adafruit_Blinka_bleio/blob/5f3c24f72a12d0e1e962a713918bd535bcf9072d/_bleio/adapter_.py#L172-L180

arslan437 commented 4 years ago

Is there any plan in near future to add peripheral support?

dhalbert commented 4 years ago

The underlying library we use for cross-platform support, https://github.com/hbldh/bleak, does not support acting as a peripheral.

arslan437 commented 4 years ago

No problem. Adafruit has really good documentation. I usually prefer to use their libraries. There is another library bluezero based on bluez I will try that.