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

Deduplicate native flow control getters/setters #203

Open
MrDOS opened this issue Jan 21, 2021 · 0 comments
Open

Deduplicate native flow control getters/setters #203

MrDOS opened this issue Jan 21, 2021 · 0 comments
Milestone

Comments

@MrDOS
Copy link
Contributor

MrDOS commented Jan 21, 2021

RXTXPort.setDTR()/isDTR()/setRTS()/isRTS()/isCTS()/setDSR()/isDSR()/isRI()/isCD() are all wrappers around TIOCMSET/TIOCMGET ioctl calls. They all follow the same pattern: the setters retrieve the current control bits and set or clear the relevant bit, then set the new control bits; and the getters retrieve the current control bits, mask out the relevant one, and return a boolean based on whether it's set. These methods are largely copy/pasted, and could be easily deduplicated into a setter function which takes the FD, the bit to set, and the desired state of that bit; and a getter function which takes the FD and the bit, and returns the state of that bit. The JNI functions would then just be thin wrappers around those functions.

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

No branches or pull requests

1 participant