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
1
vote
1 answer

DecodeError when reading Proto Buffer message from nanopb

I implemented a small HttpClient for an IoT device and wanted to use Proto Buffer as a communication format. Because of the constraints of the platform I am using nanopb. That's the relevant code in C: #include #include…
ZenCoding
  • 105
  • 8
1
vote
1 answer

Decoding repeated Submessage in nanopb

I've looked through a number of other posts but none seem to resolve my issue. I'm using nanoPB in C, creating messages in json and converting them to pb to send to my device. Given this proto message and options file message PB_BoundingArray { …
ch701x
  • 21
  • 2
1
vote
1 answer

nanopb oneof - encoding problems

I am trying to encode a message using oneof - and the size does not seem ok. Looks like this is ignoring the oneof part - and not encoding it into the stream. The encoding functions all return "TRUE" - which means that they encoded as I requested,…
elcuco
  • 8,948
  • 9
  • 47
  • 69
1
vote
1 answer

Encoding/decoding optional string fields using nanopb

I'm struggling a bit in understanding how to properly encode/decode strings in a protobuf message using nanopb. The message to encode/decode looks something like this: struct CDAPMessage { //... optional string objName = 6; // Object name,…
1
vote
1 answer

Nanopb: Submessage decoding results in incorrect data

I have various sensor types running, creating periodic events and publishing the data online. There's an overall event structure containing information about the sensor and a submessage containing data depending on what type of sensor it is. The…
1
vote
1 answer

Do I Need To Store Length Info With Protobuf?

I am storing Protobufs inside of some non-volatile memory in order to save configuration information. I am using NanoPB to decode/encode them. Since I do not know how large the encoded Protobufs are, when I go to grab a serialized proto from memory…
riley lyman
  • 317
  • 1
  • 11
1
vote
3 answers

Timestamp in nanopb

Is there support for google.protobuf.Timestamp datatype and encode decode function in nanopb ? Or we should encode/decode as int64 or may be uint32 (if possible till year 2106) ? The target device is a 32bit MCU and server end is a java based…
Dhiman
  • 59
  • 6
1
vote
1 answer

nanopb-generator.py gives error "makedirs() got an unexpected keyword argument 'exist_ok'"

I have created a virtualenv with python3. Inside the vitual environment, I have 2 proto files in my folder along with nanopb package. The structure is . ├── api.pb ├── api.proto ├── bin ├── compile.sh ├── include ├── lib ├──…
Ankit
  • 431
  • 2
  • 5
  • 18
1
vote
1 answer

c: default values for repeated fields with nanopb (protobuf)

I am trying to create a message with a repeated field which has some default values. I'm starting slow, with a simple int repeated (my final goal is a repeated message which all fields are have some value default) so, to start my proto is: syntax =…
me and stuff
  • 195
  • 1
  • 5
  • 12
1
vote
1 answer

Using 'repeated' inside 'repeated' data in Nanopb

How to properly encode data with NanoPB when having several nested 'repeated' fields? This is my schema: message Report { message SensorData { required uint32 sensorid = 1; required uint32 sample = 2; } message DeviceData { …
1
vote
1 answer

nanopb encode always size 0 (but no encode failure)

I have a very simple proto: syntax = "proto2"; message TestMessage { optional int32 val = 1; optional string msg = 2; // I set max size to 40 in options, so TestMessage_size is defined. } ...and I have the following code in my main loop…
Sam
  • 1,246
  • 1
  • 19
  • 27
1
vote
1 answer

nanopb oneof size requirements

I came across nanopb and want to use it in my project. I'm writing code for an embedded device so memory limitations are a real concern. My goal is to transfer data items from device to device, each data item has an 32bit identifier and an value.…
Ou Tsei
  • 470
  • 7
  • 24
1
vote
1 answer

Installing a CocoaPod pod (Firestore) is giving inconsistent results on same laptop

Limited CocoaPod experience here... So, I have 2 projects containing Firestore CocoaPod with the same pod file except for the application name. One of them, no matter how many times I install/update, clear cache, etc it successfully installs all the…
1
vote
2 answers

using callbacks for nested and repeated fields in a protobuf using nanopb in c

*Edit: updated * My message is defined as: message Repeat { int32 inum = 1; float fnum = 2; } message NotSimpleMessage { repeated Repeat repeat = 1; } I'm trying to write a decoder and encoder using the callback option. I think my encoding…
me and stuff
  • 195
  • 1
  • 5
  • 12
1
vote
1 answer

Nanopb - decode with PHP

I have a message encoded with Nanopb implementation of Google Protocol Buffers. I have to decode it to display the decoded result on a php page. Is it possible to do it with PHP ? If not, what is the best solution to do it in order to get an…
iAmoric
  • 1,787
  • 3
  • 31
  • 64