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
0
votes
1 answer

google protobuf - PB_BYTES_ARRAY_T(n) - what is the use of .size field?

My protobuf file is message Msg{ // User Authentication data as bytes. bytes MsgData = 1 [(nanopb).max_size = 2048]; } When I generate the C API, the relevant parts are: #define PB_BYTES_ARRAY_T(n) struct { pb_size_t size; pb_byte_t…
Bob
  • 4,576
  • 7
  • 39
  • 107
0
votes
1 answer

nanopb : get the size of repeated submessages

For a project, I'm trying to decode a repeated number of structs, which I have to fill into a dynamically allocated array, but for this to work, I need to know how many elements the repeated submessage has, in order to allocate the right size…
wilson1994
  • 93
  • 1
  • 7
0
votes
0 answers

How to solve "plugin failed code 127" compiling with nanopb

I am trying to compile a c++ code in an conan enviroment, here are details: Ubuntu 18.04 WSL x86-64 Windowns 10 x64 python 3.7.5 protoc 3.19.4 The project is located at /mnt/c/project The build directory is located at /mnt/c/build The build occurs…
0
votes
1 answer

Nanopb strip package option raises error at import

I am struggling with nanopb to get the enum of another package which has * mangle_names:M_STRIP_PACKAGE in .options file. Here is a way to reproduce the problem easily : I have a root_folder containing folder_A and folder_B. In folder_A, I have…
0
votes
1 answer

using a bytes field as proxy for arbitrary messages

Hello nano developers, I'd like to realize the following proto: message container { enum MessageType { TYPE_UNKNOWN = 0; evt_resultStatus = 1; } required MessageType mt = 1; optional bytes cmd_evt_transfer =…
woodz
  • 737
  • 6
  • 13
0
votes
1 answer

HTTP/2 client preface string missing or corrupt for C client gRPC using HTTPClient

I am getting "HTTP/2 client preface string missing or corrupt." My thoughts are that it has to do with the headers not being set correctly. It is likely the implementation of WifiClient/WifiSecureClient. I've been thinking about this for over…
gtree
  • 391
  • 2
  • 12
0
votes
1 answer

Encode/decode strings inside byte type in nanopb with C

I have a .proto file that looks like this: message ObjValue { // ... optional bytes byteval = 6 [max_size = 256]; // arbitrary structure or message // ... I use this proto encoding to send structs that change. This struct basically contains…
0
votes
0 answers

How can I find the max length of a string in python protobufs?

I have a (proto2) .proto file with a definition akin to the following: message foo { string myString = 1 [(nanopb).max_size = 20]; } How can I find the max length of "myString" in python? To get the value of an enum, I can do something like…
Maxthecat
  • 1,250
  • 17
  • 37
0
votes
1 answer

Does nanopb have python support?

Google protobufs have multi language support including languages like C/C++, python, ruby, Go, etc. protoc --cpp_out o1 --java_out o2 --python_out…
jxramos
  • 7,356
  • 6
  • 57
  • 105
0
votes
1 answer

NanoPB Help! encoding nested repeated items and not sure I have the schema defined properly

I am defining a breakdown for a battery pack. Packs are made of one or more Modules. Modules are made of 6 Cells. I have been able to get the pack information minus the repeated modules. I believe my repeated modules are now encoding but get an…
0
votes
3 answers

client server using nanopb over SSL

I am trying to implement SSL for transport layer security for client-server communication using protobuf payload. I looked at network_server example of nanopb and also openssl / wolfssl C example clients ( like…
Dhiman
  • 59
  • 6
0
votes
0 answers

nanopb based TCP client fails to interact with Java TCP Netty server

Exploring nanopb client server example and trying with other protobuf library. My question is : Is nanopb generated protobuf compatible with protobuf generated in other language like java using google's protobuf-java ? protobuf encoded in nanopb can…
0
votes
1 answer

compilation issue in protobuf with nanopb

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…
Dhiman
  • 59
  • 6
0
votes
0 answers

How do I encode repeated fields using nanopb (version 4.0)

Probably very simple, but I've spent about 4 hours combing through documentation and nothing is clear enough, or written for a version that I'm probably not using. I have a message set up like this (I'm leaving out the TimeStamp because that's…
Sopwafel
  • 43
  • 8
0
votes
1 answer

How to use nanopb over gsm modem communication where specific characters like CTRL+Z are used as msg termination in AT commands?

While looking for serialization-deserialization options, I came across nanopb meant for 32 bit controllers which use google protocol buffers. As I got curious about trying this out for an mqtt communication on a gsm modem, I realized that there is…