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

Feature: API for automatic configuration detection #278

Merged
merged 28 commits into from
May 14, 2018

Conversation

felixdivo
Copy link
Collaborator

@felixdivo felixdivo commented Mar 10, 2018

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.

@felixdivo
Copy link
Collaborator Author

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.

Copy link
Owner

@hardbyte hardbyte left a 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.
Copy link
Owner

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?

Copy link
Collaborator Author

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):
Copy link
Owner

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

@felixdivo
Copy link
Collaborator Author

@hardbyte Shall I add it to the general docs somewhere?

@felixdivo felixdivo merged commit ddfac97 into develop May 14, 2018
@felixdivo felixdivo deleted the feature-channel-detection branch May 14, 2018 14:41
@felixdivo felixdivo mentioned this pull request May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants