-
Notifications
You must be signed in to change notification settings - Fork 597
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
Feature: API for automatic configuration detection #278
Conversation
…nd the global channels variable
This branch now contains the new API for automatic channel detection, as well as implementations for the virtual and socketcan (native & ctypes) interfaces. There are unit tests covering these cases. I would merge this in a few days if no one comments on this any more or points out some docs that should be added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool - looks handy.
"""Detect all configurations/channels that this interface could | ||
currently connect with. | ||
|
||
This might be quite time consuming. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider passing a timeout value or abort
event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not really, since that would be comparably difficult to implement and is not necessary for the two interfaces I implemented it for. (socketcan
& virtual
) Do you really think we need it?
can/interface.py
Outdated
return cls(channel=config['channel'], *args, **kwargs) | ||
|
||
|
||
def detect_available_configs(search_only_in=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit of a nitpick but can we please rename search_only_in
to interfaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
@hardbyte Shall I add it to the general docs somewhere? |
I added an API for interfaces to support automatic detection of currently available configurations/channels. The API does not require any changes to existing interfaces.
It only supports our internal interfaces for now, but I am open to suggestions on how to make it accessible for user defined buses as well.
I implemented the config detection in the virtual bus for now but plan to add more. While adding it, I also added some locks to the virtual bus since I noticed they are required there.
Based on #51. Closes #51.