How do I use Google protobuf to communicate over a serial port?
- by rob
I'm working on a project that uses RXTX and protobuf to communicate with an application on a development board and I've been running into issues which implies that I'm likely doing things the wrong way. Here's what I currently have for writing the request to the board (the read code is similar):
public void write(CableCommandRequest request, OutputStream out) {
CodedOutputStream outStream = CodedOutputStream.newInstance(out);
request.writeTo(outStreatm);
outStream.flush();
}
The OutputStream that is used is prepared by RXTX and the development board seems to indicate that data is being received, but it is getting garbled or is otherwise not being understood.
There seems to be little documentation on using protobuf over a serial connection so I'm assuming that passing the OutputStream should be sufficient. Is this in fact correct, or is this the wrong way of sending the response over the serial connection?