When I enter data into the terminal a strange series of characters is being sent/received.
Screenshot of what appears in the terminal when i write "test":
And the log showing the strings sent and the data received.
Is there any way to fix this without parsing out characters, this might prove annoying if I actually need to type those characters!
When I type in the terminal this is run:
This is what I call to send data. sendData(Byte data) is a library method.
Once data is sent the reply is received here:
So it works well if I don't send if over serial, even though I can see weird bytes in the logs too, after I send them over serial and they return however they actually get written to the terminal?
Anyway to solve this without just parsing out occurrences of ~0?
D. Smith wrote:How is the data getting from the keyboard on the device into the write() method? It looks like each character you type is getting interpreted as four bytes (perhaps cast to an int along the way?) before being passed to this method. Also, what does the sendOverSerial() method look like? Is that a method in the library you are using? I could not find GraphicsTerminalActivity in the GitHub source code.
Hi, I believe this is the class in the library that defines what happens when I type in the terminal https://github.com/jackpal/Android-Terminal-Emulator/blob/master/libraries/emulatorview/src/jackpal/androidterm/emulatorview/EmulatorView.java
It is getting 4 bytes as you say, but I have no idea why. sendOverserial just sends a byte array over serial, that's all, a byte array is sent back then. The data sent is already corrupted before I send it, with these extra 3 bytes. This method is from a different library. GraphicsTerminalActivity is my personal activity using the library linked in the opening post.