Questions tagged [nanopb]

A C library implementing Google's Protocol Buffers data format. Mainly targeted towards embedded / limited resources use cases.

Nanopb is a plain-C implementation of Google's Protocol Buffers data format. It is targeted at 32-bit microcontrollers but is also fit for other embedded systems with tight (2-10 kB ROM, <1 kB RAM) memory constraints.

Project homepage

GitHub Repository

87 questions
6
votes
1 answer

How to encode a string when it is a pb_callback_t type

I'm working with Nanopb, where the string variable from the generated proto file, is converted to pb_callback_t So, far I'm trying with a test example of callbacks from nanopb; bool encode_string(pb_ostream_t* stream, const pb_field_t* field, void*…
John Dign
  • 147
  • 1
  • 8
5
votes
2 answers

Can Protobuf communicate with NanoPB

My task is to connect via bluetooth from an android device to the device running nanoPB. I know NonoPB handles certian things like enums diffrently... Can NanoPB handle enums if they are passed? Or failing that will any of the Protobuf modes like…
Mytheral
  • 3,929
  • 7
  • 34
  • 57
4
votes
2 answers

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

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…
me and stuff
  • 195
  • 1
  • 5
  • 12
4
votes
1 answer

how to compile .proto + .options file using nanopb

i wrote an .options file and placed it in the same directory as the .proto file. then, I tried to compile it (using nanopb compiler) by using the command generator-bin/protoc --nanopb_out=. message.proto -s message.options and got this…
me and stuff
  • 195
  • 1
  • 5
  • 12
4
votes
1 answer

using repeated field rule in a message with nanopb in c

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…
me and stuff
  • 195
  • 1
  • 5
  • 12
4
votes
1 answer

Geofire (iOS) clang: error: linker command failed with exit code 1 (use -v to see invocation)

I'm using GeoFire (2.0.0) in the Swift project, after today's update pods when the project is going to Xcode shows clang: error: linker command failed with exit code 1 (use -v to see invocation) in the Geofire framework. Tell me, how can I fix…
Alexander Khitev
  • 6,417
  • 13
  • 59
  • 115
3
votes
1 answer

how do i know in advance that the buffer size is enough in nanopb?

im trying to use nanopb, according to the example: https://github.com/nanopb/nanopb/blob/master/examples/simple/simple.c the buffer size is initialized to 128: uint8_t buffer[128]; my question is how do i know (in advance) this 128-length buffer is…
furynerd
  • 109
  • 1
  • 8
3
votes
1 answer

How to compile nanopb .proto file into .h and .c files using nanopb and protobuf (`protoc` compile question)

Old title: How to compile nanopb/examples/simple/simple.proto file into simple.h and simple.c using nanopb and protobuf Regarding this library: https://github.com/nanopb/nanopb My goal is to follow this tutorial:…
Gabriel Staples
  • 36,492
  • 15
  • 194
  • 265
3
votes
1 answer

Defining a MAC address using protocol buffers

I am trying to define an eight byte MAC address data element using protocol buffers in C. I have tried: message mac { required bytes address = 1 [(nanopb).max_size = 8]; } but this creates a structure with a size field and an eight byte…
Bryan
  • 31
  • 2
2
votes
1 answer

Nanopb: add already encoded messages as a repeated field

I have message of the form: message OuterMessage { repeated InnerMessage msg = 1; } I would like to compose an instance of OuterMessage by appending already encoded instances of InnerMessage. Is there a legit way to do this with nanopbs?
2
votes
1 answer

How do I clear a stream in C++ for a nanoPB protocol buffer to use?

I'm using nanopb in a project on ESP32, in platformIO. It's an arduino flavored C++ codebase. I'm using some protobufs to encode data for transfer. And I've set up the memory that the protobufs will use at the root level to avoid re-allocating the…
chrispitzer
  • 991
  • 1
  • 8
  • 26
2
votes
2 answers

How to install updated version of nanopb along with Firebase

I am trying to update, Firebase version to 8.4.0 and running into following error. To update, I specified the Firebase/Core, Firebase/Crashlytics, Firebase/Performance's version to 8.4.0 in my pod file. Now, when running pod install, I got following…
Natasha
  • 6,651
  • 3
  • 36
  • 58
2
votes
1 answer

Using nanopb and protobuf for serialisation/deserialisation together in applications

Is it possible to have two applications App-1 and App-2, one runs on OS-1 another on OS-2. App-1 serialises/deserialises data with nanopb and communicates with App-2. App-2 serialises/deserialises data with google protobuf and communicates with…
2
votes
1 answer

Nanopb -Decoding failed: zero tag

This is my first time writing here so excuse me if i did sometihing wrong. I need help with "Decoding failed: zero tag" status. I want to send array using ESP-NOW Here is my encoding side: epostavke.baterija[0]=razina_baterije[0]; …
Antisa
  • 31
  • 1
  • 1
  • 3
2
votes
1 answer

Deserializing a Streamed Protocol Buffer Message With Header and Repeated fields

I am working on deserializing a log file that has been serialized in C using protocol buffers (and NanoPB). The log file has a short header composed of: entity, version, and identifier. After the header, the stream of data should be continuous and…
Asan
  • 327
  • 3
  • 17
1
2 3 4 5 6