How do I use Google protobuf to communicate over a serial port?
Posted
by
rob
on Stack Overflow
See other posts from Stack Overflow
or by rob
Published on 2013-06-28T02:20:12Z
Indexed on
2013/06/28
4:21 UTC
Read the original article
Hit count: 662
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?
© Stack Overflow or respective owner