Skip to content
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

_bleio does not accept data as a kwarg in start_advertising #5405

Closed
SomTambe opened this issue Sep 29, 2021 · 2 comments
Closed

_bleio does not accept data as a kwarg in start_advertising #5405

SomTambe opened this issue Sep 29, 2021 · 2 comments
Labels

Comments

@SomTambe
Copy link

SomTambe commented Sep 29, 2021

CircuitPython version

Adafruit CircuitPython v 7.0.0

Code/REPL

import _bleio

adp = _bleio.adapter
msg = bytes('abcde', 'utf-8')
adp.start_advertising(data=msg, # msg is of bytes type
                      connectable=True, 
                      anonymous=True, 
                      timeout=30, 
                      interval=0.1, 
                      tx_power=4)

Behavior

Traceback (most recent call last):
  File "\<stdin\>", line 5, in \<module\>
TypeError: function missing 1 required positional arguments

Description

It works when I pass msg as a normal argument:

adp.start_advertising(msg,
                       connectable=True,
                       anonymous=True,
                       timeout=30,
                       interval=0.1,
                       tx_power=4)
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
_bleio.BluetoothError: Unknown system firmware error: 0009 

Should have worked in the previous case also, especially when the docs show it as a kwarg.

PS: If you could also help me resolve the _bleio.BluetoothError: Unknown system firmware error: 0009, that would be great! I tried sending a blank string payload, it worked, but it is not working if I send any other string. What should I do?

Additional information

Board: Adafruit nRF52840 Bluefruit Feather Sense

@SomTambe SomTambe added the bug label Sep 29, 2021
@dhalbert
Copy link
Collaborator

PS: If you could also help me resolve the _bleio.BluetoothError: Unknown system firmware error: 0009, that would be great! I tried sending a blank string payload, it worked, but it is not working if I send any other string. What should I do?

The data you're trying to send is an ill-formed advertisement. An advertisement contains chunks of data in a specific format, with type and length bytes, etc. If you use the https://github.com/adafruit/Adafruit_CircuitPython_BLE library, it will help you build up these advertisements.

The keyword arg thing is another problem, which we'll look at in more detail. We may open a more general issue for that.

@dhalbert
Copy link
Collaborator

Closing in favor of #5407.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants