Skip to content

Conversation

@felixdivo
Copy link
Collaborator

@felixdivofelixdivo 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
CollaboratorAuthor

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.

@felixdivofelixdivo removed the request for review from christiansandbergApril 29, 2018 21:20
Copy link
Owner

@hardbytehardbyte 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
CollaboratorAuthor

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?

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
CollaboratorAuthor

Choose a reason for hiding this comment

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

Sure.

@felixdivo
Copy link
CollaboratorAuthor

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

@felixdivofelixdivo merged commit ddfac97 into developMay 14, 2018
@felixdivofelixdivo deleted the feature-channel-detection branch May 14, 2018 14:41
@felixdivofelixdivo mentioned this pull request May 16, 2018
Sign up for freeto 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.

3 participants

@felixdivo@hardbyte