You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WriteBytes does not return how many bytes were not written #129
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?
I don't believe this is possible currently. To support this without breaking backwards compatibility, a new function (e.g. write(bytes[])) would have to be written and the old boolean functions would have to be update to check the return length.
This would require Windows and Unix C++ code to be updated to return jint and the current functions would be wrapped to still return a boolean.
Disclaimer, this library is mostly in maintenance mode, so any features would have to be authored by the vested/interested parties.
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?
So is this at all possible with the C stack being used? Or do I have to try?
Thanks!
Best
Daniel
So is this at all possible with the C stack being used? Or do I have to try?
I think the Unix code makes it relatively easy, but I'm not sure about the win32 API. Perhaps the answer lies in GetOverlappedResult returning a zero? I'm not very familiar with hardware flow control and only partially familiar with the C++ portions of the codebase. We do have some other volunteers here as well as a Slack channel if interested. @hiddenalpha has been very helpful with the C++ portions as well.
Activity
tresf commentedon Sep 21, 2022
Hi,
I don't believe this is possible currently. To support this without breaking backwards compatibility, a new function (e.g.
write(bytes[])) would have to be written and the old boolean functions would have to be update to check the return length.This would require Windows and Unix C++ code to be updated to return
jintand the current functions would be wrapped to still return a boolean.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
danielgruber commentedon Sep 21, 2022
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?
So is this at all possible with the C stack being used? Or do I have to try?
Thanks!
Best
Daniel
tresf commentedon Sep 21, 2022
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
GetOverlappedResultreturning a zero? I'm not very familiar with hardware flow control and only partially familiar with the C++ portions of the codebase. We do have some other volunteers here as well as a Slack channel if interested. @hiddenalpha has been very helpful with the C++ portions as well.hiddenalpha commentedon Sep 22, 2022
Looks related to issue #96
Make 'write()' return number of bytes written
Make 'write()' return number of bytes written
Make writeBytes() return how many bytes actually got written