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

Nanopb get string from pb_ostream_t

I am using nanopb so I can implement protobuf with some small, cross compiled code. I have the base of it working but would like to get the encoded protobuf message as a string for sending via UDP (on another system). Normally with the full blown…
Chuck Claunch
  • 1,624
  • 1
  • 17
  • 29
0
votes
2 answers

protobuff nanopb encode from struct

is there a way to encode structs or classes with nanopb? I want to hold a struct an encode it with nanopb. protofile syntax = "proto2"; package genericgateway; message Config { required string deviceId = 1; repeated DataConnection data = 2; …
0
votes
0 answers

Flutter App in XCode 14 build failing due to error: double-quoted include in framework header, expected angle-bracketed instead

I have been building a flutter app for some months now and suddenly Xcode is throwing the following errors from the files of the nanopb pod folder: Error (Xcode): double-quoted include "pb.h" in framework header, expected angle-bracketed…
0
votes
1 answer

Nanopb encode empty when only fields in submessages

With this settings.proto file syntax = "proto3"; message SerialPort { int32 baudrate = 3; } message Settings { SerialPort serialInterface = 1; int32 test = 2; } I try to encode a message that only has the baudrate set with…
Katu
  • 1,296
  • 1
  • 24
  • 38
0
votes
0 answers

IOS Azure Pipeline Xcode Build Error Nanopb "File exists but is not a directory"

I'm trying to create pipeline in Azure Devops but I get the following error: /usr/bin/xcodebuild -version Xcode 13.2.1 Build version 13C100 /usr/bin/xcodebuild -sdk iphoneos -configuration Release build -allowProvisioningUpdates |…
Jealian
  • 105
  • 13
0
votes
1 answer

Decoding oneof Nanopb

I am currently working with oneof properties. I am able to encode them without issue, however, decoding seems to be an issue. I fail to understand why it doesn't work. My proto file looks like this: syntax = "proto2"; message stringCallback{ …
J.Meulenbeld
  • 185
  • 1
  • 17
0
votes
1 answer

NanoPB encode & decode repeated int32_t values

I have a problem when I encode my int array into a message and then decode it in my C# application. When I decode my int array, I get send the encoded bytes to C# by MQTT. I decode it there and all my values are doubled there. I then send the same…
J.Meulenbeld
  • 185
  • 1
  • 17
0
votes
0 answers

Nanopb decoded string has left over characters

I am decoding a string field with NanoPB. During the decoding, the string returns to me with the correct content, however, there are some left-over characters at the end. My proto message: syntax = "proto2"; message stringCallback{ required…
J.Meulenbeld
  • 185
  • 1
  • 17
0
votes
1 answer

NanoPB Callback functions

I am working on a project which includes the use of NanoPB. Currently I have the situation where in my protofile I have multiple callback fields. I now must encode and decode these callback fields using my own written callback functions. My question…
J.Meulenbeld
  • 185
  • 1
  • 17
0
votes
0 answers

nanopb - binary compatibility between different processor architectures

I am using nanopb/google-protobuf between an ARM processor and Infineon Aurix. QUESTION Are there possible binary compatibility issues when communicating between different processor architectures? Are there configuration flags that I could set, on…
Bob
  • 4,576
  • 7
  • 39
  • 107
0
votes
1 answer

nanopb - how to specify encoding of integer in proto file

How do I set a int32 to use a fixed size for encoding? In the API, it says PB_LTYPE_FIXED32 0x04 32-bit integer or floating point. But what option do I set in the .proto file to encode a int32 as a PB_LTYPE_FIXED32 as opposed to a…
Bob
  • 4,576
  • 7
  • 39
  • 107
0
votes
1 answer

nanopb/protobuf - how to force max size serialization/encoding

Documentation for pb_ostream_from_buffer says After writing, you can check stream.bytes_written to find out how much valid data there is in the buffer. This should be passed as the message length on decoding side. So ideally, when I send the…
Bob
  • 4,576
  • 7
  • 39
  • 107
0
votes
0 answers

nanopb - what is Person_PhoneNumber_FIELDLIST macro?

Docs: #define Person_PhoneNumber_FIELDLIST(X, a) \ X(a, STATIC, REQUIRED, STRING, number, 1) \ X(a, STATIC, OPTIONAL, UENUM, type, 2) I do not see this macro being used. Is there a use for this for a user of the…
Bob
  • 4,576
  • 7
  • 39
  • 107
0
votes
1 answer

nanopb, google-protobuf - can I set the length of the message as part of the serialized data itself?

I have a message message Msg { uint32 a; uint32 b; bool c; } When I write a message using pb_encode I notice that the amount of stream.bytes_written depends on how many of the Msg fields were changed from their default. I really do not want to send…
Bob
  • 4,576
  • 7
  • 39
  • 107
0
votes
1 answer

nanopb pb_istream_from_buffer - what is value of bufsize?

pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize); buf - Pointer to byte array to read from. bufsize Size of the byte array. What is the argument for bufsize? Is it the macro in the .pb.h file under the heading /*…
Bob
  • 4,576
  • 7
  • 39
  • 107