Bytes field between Python and C (Nanopb)

295 views
Skip to first unread message

Renaud Piperade

unread,
Mar 31, 2022, 3:23:55 AM3/31/22
to Protocol Buffers
Hello,
I am trying to use Protobuf between a C99 program (with Nanopb) and python3.9.2 program. The communication take place through a serial port communication (with pty under a Debian machine).
I have the following message:

syntax = "proto3"
import "nanopb.proto";
message My_msg {
    uint32 time = 1;     
    bytes data = 4 [(nanopb).max_size = 255]; 
}

I am facing an issue with the bytes field. Does someone know how to "read", "write" and display the "data" variable on python and C (with an example with this message can help me a lot) ?
Thank you by advance,
Renaud

Deanna Garcia

unread,
May 2, 2022, 2:30:14 PM5/2/22
to Protocol Buffers
Bytes fields shouldn't be any different than other fields. You should still be able to get and set the variables as explained in the tutorial.
Reply all
Reply to author
Forward
0 new messages