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

Cannot parse 'AddDevice' response... #9

Open
antoniovazquezblanco opened this issue Jul 4, 2024 · 0 comments
Open

Cannot parse 'AddDevice' response... #9

antoniovazquezblanco opened this issue Jul 4, 2024 · 0 comments

Comments

@antoniovazquezblanco
Copy link

The following command fails on response parsing...

from btsocket import btmgmt_sync
from btsocket.btmgmt_protocol import AddressType
response = btmgmt_sync.send('AddDevice', 0, '00:11:22:33:44:55', [AddressType.BREDR], 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/.../venv/lib/python3.12/site-packages/btsocket/btmgmt_sync.py", line 28, in send
    data = btmgmt_protocol.reader(raw_data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../venv/lib/python3.12/site-packages/btsocket/btmgmt_protocol.py", line 1083, in reader
    evt_params = header.decode(pckt)
                 ^^^^^^^^^^^^^^^^^^^
  File "/.../venv/lib/python3.12/site-packages/btsocket/btmgmt_protocol.py", line 238, in decode
    data_type.decode(pkt[pointer:pointer + param.width])
  File "/.../venv/lib/python3.12/site-packages/btsocket/btmgmt_protocol.py", line 110, in decode
    self.value = Events(int.from_bytes(data, byteorder='little'))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/enum.py", line 757, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/enum.py", line 1171, in __new__
    raise ve_exc
ValueError: 42 is not a valid Events
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant