nanopb

Nanopb without callbacks

杀马特。学长 韩版系。学妹 提交于 2021-02-11 17:58:24
问题 I'm using Nanopb to try and send protobuf messages from a VxWorks based National Instruments Compact RIO (9025). My cross compilation works great, and I can even send a complete message with data types that don't require extra encoding. What's getting me is the callbacks. My code is cross compiled and called from LabVIEW and the callback based structure of Nanopb seems to break (error out, crash, target reboots, whatever) on the target machine. If I run it without any callbacks it works great

Streaming data with ProtoBuf to log file with a header

徘徊边缘 提交于 2021-01-27 23:18:05
问题 I am trying to stream data to a log file on an SD card on a microcontroller that reads from some sensors and stores the value in the file. To serialize the data I will be using NanoPB, the protobuf implementation for C which is quite resource efficient. The log file has the following structure: It needs to write a short header composed of a GUID, and a firmware version. After the header, the stream of data should be continuous and it should log the fields from the sensors but not the header

compilation issue in protobuf with nanopb

♀尐吖头ヾ 提交于 2020-12-15 03:45:49
问题 I am using nanopb library I seek your suggestion to resolve build issue - I am using protobuf 3.12,nanopb 0.4.2, puython3,gcc . I compiled protoc both c and python but still faced issue while building. make protoc -osimple.pb simple.proto - step done nanopb/examples/simple $ python ../../generator/nanopb_generator.py simple.pb -> following error $ python3 ../../generator/nanopb_generator.py simple.pb Traceback (most recent call last): File "../../generator/nanopb_generator.py", line 50, in

using repeated field rule in a message with nanopb in c

强颜欢笑 提交于 2019-12-11 03:45:16
问题 I'm having a hard time in realizing how to use the repeated field rule. for example, this is my .proto: message Test { repeated float value = 1; } now, I'm initialize a new Test object: Test test = test_init_zero() Finally, I want to assign some values. For example: float values[] = { 1.0, 2.2, 5.5, 7.13 } My question is how can I assign them? is it like test.value = values //or test.value[0] = values[0] //... etc. and then, how do I read them back? 回答1: This depends on how you define the

creating callbacks and structs for repeated field in a protobuf message in nanopb in c

纵然是瞬间 提交于 2019-12-11 02:05:49
问题 I have a proto message defined as: message SimpleMessage { repeated int32 number = 1;} now, after compiling, the field is of pb_callback_t and I suppose to write that function. (without .options file) now, where and what should the function contain? where does the data itself being stored and how can I access it/ assign new data to it? * EDIT * according to @Groo 's answer, this is the code I tried: typedef struct { int numbers_decoded; } DecodingState; bool read_single_number(pb_istream_t