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

device builder API #6

Merged
merged 3 commits into from
Apr 20, 2020
Merged

device builder API #6

merged 3 commits into from
Apr 20, 2020

Conversation

tanriol
Copy link
Owner

@tanriol tanriol commented Apr 20, 2020

Split Context into Builder (device not opened yet, can choose interface) and Device (interface chosen, device opened, can interact with it). This makes a number of API misuses, such as trying to change interface on the fly or send data before opening interface, impossible.

@tanriol tanriol marked this pull request as draft April 20, 2020 23:24
@tanriol
Copy link
Owner Author

tanriol commented Apr 20, 2020

@cr1901 I'm pretty sure I'll merge this for the next version, possibly with some changes (for example, I can re-introduce Context as an internal wrapper over the *mut ftdi_context), so you may want to check whether and how it affects error handling.

@cr1901
Copy link
Contributor

cr1901 commented Apr 20, 2020

@tanriol Merge it, I'll handle the fallout of merging it back into my branch (merge commit is okay? It's preferable to a rebase for me at this point.).

(for example, I can re-introduce Context as an internal wrapper over the *mut ftdi_context), so you may want to check whether and how it affects error handling.

What would the different between Context and Device be then? Context provides lower-level methods that directly call into libftdi1 and Device provides higher-level methods?

@tanriol
Copy link
Owner Author

tanriol commented Apr 20, 2020

What would the different between Context and Device be then? Context provides lower-level methods that directly call into libftdi1 and Device provides higher-level methods?

I decided to go without that for now, but it would have been Context providing the Drop impl and functionality shared between Device and Builder (if any). However, it looks like there's not much common functionality there.

@tanriol tanriol marked this pull request as ready for review April 20, 2020 23:39
@tanriol tanriol merged commit 7d706ed into master Apr 20, 2020
@tanriol tanriol deleted the device-builder branch April 20, 2020 23:40
@tanriol tanriol changed the title [WIP, RFC] device builder API device builder API Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants