Skip to content

Implement _detect_available_configs for the Ixxat bus. #1607

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

Merged
merged 9 commits into from
Oct 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix doctest
  • Loading branch information
MattWoodhead authored and zariiii9003 committed Oct 16, 2023
commit 0fbd8678b47e7ca98536c0d2b2ed0108d5eea6b8
17 changes: 12 additions & 5 deletions doc/interfaces/ixxat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,22 @@ The function :meth:`~can.detect_available_configs` can be used to generate a lis
.. testsetup:: ixxat

from unittest.mock import Mock
can.detect_available_configs = Mock(side_effect=lambda: [{'interface': 'ixxat', 'channel': 0, 'unique_hardware_id': 'HW441489'}, {'interface': 'ixxat', 'channel': 0, 'unique_hardware_id': 'HW107422'}, {'interface': 'ixxat', 'channel': 1, 'unique_hardware_id': 'HW107422'}])
import can
assert hasattr(can, "detect_available_configs")
can.detect_available_configs = Mock(
"interface",
return_value=[{'interface': 'ixxat', 'channel': 0, 'unique_hardware_id': 'HW441489'}, {'interface': 'ixxat', 'channel': 0, 'unique_hardware_id': 'HW107422'}, {'interface': 'ixxat', 'channel': 1, 'unique_hardware_id': 'HW107422'}],
)

.. doctest:: ixxat

>>> import can
>>> print(can.detect_available_configs("ixxat"))
[{'interface': 'ixxat', 'channel': 0, 'unique_hardware_id': 'HW509182'},
{'interface': 'ixxat', 'channel': 0, 'unique_hardware_id': 'HW107422'},
{'interface': 'ixxat', 'channel': 1, 'unique_hardware_id': 'HW107422'}]
>>> configs = can.detect_available_configs("ixxat")
>>> for config in configs:
... print(config)
{'interface': 'ixxat', 'channel': 0, 'unique_hardware_id': 'HW441489'}
{'interface': 'ixxat', 'channel': 0, 'unique_hardware_id': 'HW107422'}
{'interface': 'ixxat', 'channel': 1, 'unique_hardware_id': 'HW107422'}


You may also get a list of all connected IXXAT devices using the function ``get_ixxat_hwids()`` as demonstrated below:
Expand Down