How to get the TX status in Java Midlet on EHS6 | Telit Cinterion IoT Developer Community
June 24, 2015 - 3:54am, 3253 views
We are using EHS6 module and its ASC0 for serial port comms. A function we developed would need to know whether the messages have been sent out (buffer emptied) after the midlet writes the messages to the serial port. We haven't found a method in the Java document that can get this status? Does anyone have suggestions/ideas?
You could make sure that msg was sent with flush():
(source: https://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html)
But I am not sure what did they mean with: "The
flush
method ofOutputStream
does nothing."Regards,
Jure
Hello,
As Java is a high-level programming language there is no method for controlling directly the underlying buffers of the operating system and serial interface.
If this is critical for you to know when the data have been really sent out, you would probably need some extra hardware for that. Flashing the stream will not give you this information and in case of OutputStream it actually does nothing according to the documentation.
Regards,
Bartłomiej
Thanks for all of your feedback.
We did try Flush() and it didn't work as Bartłomiej suggested. We also thought of using RTS signal in HW flow control mode but RTS wasn't the signal we really need as it would only be inactive (high) when input buffer was full (not for the non empty output buffer).
We looked at Oracle JAVA ME Doc website, in the DIO API package, there are quite a few UART methods available, inlcuding signal controls and event listeners.
http://docs.oracle.com/javame/8.0/api/dio/api/index.html
For UART APIs, there is UARTEvent class that encapsulates events fired by devices that implement the UART interface and there is an event field OUTPUT_BUFFER_EMPTY. Don't know wheter this can help or not. Also, the Java platform for the EHS6 may not have the DIO package included though.
Thanks.
Luke
The EHS6 Java platform does not include DIO package and there's no API to access the low level UART interface from Java.