Skip to content

Cannot parse 'AddDevice' response... #9

@antoniovazquezblanco

Description

@antoniovazquezblanco

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions