-
Notifications
You must be signed in to change notification settings - Fork 53
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
WriteBytes does not return how many bytes were not written #129
Comments
Hi, I don't believe this is possible currently. To support this without breaking backwards compatibility, a new function (e.g. This would require Windows and Unix C++ code to be updated to return Disclaimer, this library is mostly in maintenance mode, so any features would have to be authored by the vested/interested parties. Relevant functions: Unix: jssc/src/main/cpp/_nix_based/jssc.cpp Lines 528 to 535 in 6886b44
Windows: jssc/src/main/cpp/windows/jssc.cpp Lines 234 to 257 in 6886b44
|
Hi @tresf, Thanks for your update! I’m happy to implement the changes, still I would first want to know if there was a reason behind it not to implement it like this from the beginning? |
Hi, this project is a fork of the original from https://github.com/scream3r/java-simple-serial-connector, so the history behind this decision likely lies there.
I think the Unix code makes it relatively easy, but I'm not sure about the win32 API. Perhaps the answer lies in |
Looks related to issue #96 |
Some thoughts about java-native#129 What this commit does: - Make native impls return numberOfBytesWritten. - Throw SerialPortException in case write fails in some way. - Expose new 'write()' method to java which returns numberOfBytesWritten and uses exceptions for error handling. - Keep old 'writeBytes()' method and translate to the old behavior. What this commit does NOT: THIS CODE IS NOT TESTED! It even was not launched at all. Nevertheless it did compile fine for x86_64-linux-gnu (debian) and mingw (cross-compile). So we need to do: - Testing! - Review if the change in the API (adding a 'write()' method) is the thing we should do or if we should do it differently somehow. (wip @ 36ee5d8)
Some thoughts about java-native#129 and java-native#96 What this commit does: - Make native impls return numberOfBytesWritten. - Throw SerialPortException in case write fails in some way. - Expose new 'write()' method to java which returns numberOfBytesWritten and uses exceptions for error handling. - Keep old 'writeBytes()' method and translate to the old behavior. What this commit does NOT: THIS CODE IS NOT TESTED! It even was not launched at all. Nevertheless it did compile fine for x86_64-linux-gnu (debian) and mingw (cross-compile). So we need to do: - Testing! - Review if the change in the API (adding a 'write()' method) is the thing we should do or if we should do it differently somehow. (wip @ 36ee5d8)
Hello,
At the moment we encountered that writeBytes does not return how many bytes were written. For a CTS / RTS flow, this is absolutly necessary. Is there a reason why this is not needed / or how we use this library correctly with hardware CTS / RTS without losing data in the middle?
Thanks a lot!
Best
Daniel
The text was updated successfully, but these errors were encountered: