-
Notifications
You must be signed in to change notification settings - Fork 21
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
Merge or split high-level and low-level API #68
Comments
Actually, on second thoughts, I think a much cleaner solution would be to move the high-level and low-level APIs into separate modules, e.g. called Advantages:
|
@mgkuhn I agree with your updated suggestion (apart from the final point), and this is how most Julia C wrappers are constructed. On the final point, in my view it is best to have the C wrapper follow the library naming as closely as possible, and to perform the
|
The low-level API wrappers now sit in a submodule LibSerialPort.wrap. The high-level API currently still re-exports a few symbols from that low-level API module, to preserve backwards compatibility. This is due to * my previously started attempt to merge the low and high-level APIs for the three functions sp_flush, sp_drain, and sp_output_waiting * the fact that several high-level APIs currently still refer to enum types and constants defined by the low-level API We may want to phase out either or both in future, for a cleaner separation, and a more Julian high-level API.
I have now implemented this split, i.e. moved the low-level wrappers into a separate module If this gets merged, I'll then also start to tidy up the situation around |
The low-level API wrappers now sit in a submodule LibSerialPort.Lib. The high-level API currently still re-exports a few symbols from that low-level API module, to preserve backwards compatibility. This is due to * my previously started attempt to merge the low and high-level APIs for the three functions sp_flush, sp_drain, and sp_output_waiting * the fact that several high-level APIs currently still refer to enum types and constants defined by the low-level API We may want to phase out either or both in future, for a cleaner separation, and a more Julian high-level API.
…ow-control setting in tests) (#74) * fix test_low_level_api() by actually disabling flow control This test routine claimed in a comment to disable flow control. It actually requires the serial port to be transparent for all 256 byte values, which in turn requires deactivation of software flow control, because otherwise the byte-transparency tests fail for bytes 0x11 (Ctrl-Q, XON) and 0x13 (Ctrl-S, XOFF) on systems such as Ubuntu Linux where software flow control is active by default. * completed read/write timeout implementation in high-level API Added new functions to set and clear cumulative timeouts for blocking read and write functions, a new `Timeout` exception that will be thrown, and time-tracking code in calls to the blocking read/write functions. This way, users can now set overall timeouts on other IO functions, such as `readuntil`, that make multiple calls to our blocking functions. * change close(::SerialPort) to return nothing That what other close(::IO) methods in Base do. It looks quite odd in the REPL to get the entire closed SerialPort object thrown back at you. * build HTML documentation using Documenter.jl also polished some docstrings and fixed a parameter name inconsistency * split low-level API into separate module (#68) The low-level API wrappers now sit in a submodule LibSerialPort.Lib. The high-level API currently still re-exports a few symbols from that low-level API module, to preserve backwards compatibility. This is due to * my previously started attempt to merge the low and high-level APIs for the three functions sp_flush, sp_drain, and sp_output_waiting * the fact that several high-level APIs currently still refer to enum types and constants defined by the low-level API We may want to phase out either or both in future, for a cleaner separation, and a more Julian high-level API. * documentation typo fixed * allow arm64 to fail Arm64 builds have long filed, therefore let's allow them to fail in Travis until that problem is fixed, such that PR authors for other issues do not get build errors that they are not responsible for.
The main part of this issue is now fixed in release
These currently simply pass through to the high-level API three functions from the low-level API, by adding corresponding
What should the high-level API equivalents of Anyone here who is better than me with English verbs of getting rid of things (discard, dispose, jettison, eject, scrap, ditch, dump, flush, drain, empty, reset, zeroize, ...)? How about using truncate and flush as in
As these two existing Julia I/O functions probably have the closest semantic equivalence to |
This suggestion would be a big breaking change, but possibly worth it.I believe LibSerialPort would become far more user friendly if we merged the high-level and low-level APIs. The resulting single API is closer to the current high-level API, in that almost all methods in it have a first argument of typeLibSerialPort.SerialPort
(or theIO
supertype), but it also provides all the advanced facilities currently only found in the low-level API.Users of the high-level interface will often want to have access to many of the methods of the low-level interface (e.g., draining buffers, accessing modem control lines, etc.).
But duplicating large parts of the low-level interface in the high-level interface could leads to duplication of code, documentation and tests.It is much more user friendly if there is only one documented function for each purpose, and that function should copy an adapted version of most of the text found in the documentation of the correspondinglibserialport
function (such that LibSerialPort users do not have to read thelibserialport
C documentation).New users should not have to be confronted with first having to make a choice between using one of two APIs, unless there are extremely good technical reasons for having to make such a choice (which I doubt we have here).
The text was updated successfully, but these errors were encountered: