Note: after trying to encode the same structure through the python API (SerializeToString), I noticed there was only a slight difference between the API's output and the output I get from the c file. C: a481e100102181201032d496d2053657269616c697a6564 API:
0a04081e1000100218012010320d496d2053657269616c697a6564 As you can see there are some missing 0's, I would like to know what is wrong with the encoding I am doing on my C file ב-יום שני, 20 במרץ 2023 בשעה 16:24:09 UTC+2, Yarden Regev כתב/ה: > Hello, > I am trying to transfer message from type loggerMessage from C to python > over UART: > > status = pb_encode(&stream, loggerMessage_fields, &message); > message_length = stream.bytes_written; > int i=0; > printf("\r\n"); > > for (i = 0; i <message_length; ++i) { > printf("%x",buffer[i]); > } > > In python when reading this and converting to binary, ParseFromString > throws google.protobuf.message.DecodeError: Error parsing message: > > log = loggerMessage_pb2.loggerMessage() > binary_str = binascii.unhexlify(answer) > log.ParseFromString((binary_str)) > > What is the problem with the way I am sending/receiving? > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/d7fcf0aa-010d-4054-beb3-1b913db658b8n%40googlegroups.com.