Difference between revisions of "Protobuf notes"

From Wiki at Neela Nurseries
Jump to: navigation, search
m (Project kitsune setup_protobuf() function.)
m (Nanopb concepts.md documentation from googlesource.com.)
Line 4: Line 4:
 
*  https://protobuf.dev/getting-started/cpptutorial/
 
*  https://protobuf.dev/getting-started/cpptutorial/
 
*  https://protobuf.dev/programming-guides/proto3/
 
*  https://protobuf.dev/programming-guides/proto3/
 +
 +
Also a good more detailed introduction:
 +
 +
*  https://chromium.googlesource.com/external/github.com/nanopb/nanopb/+/refs/heads/master/docs/concepts.md
  
 
When compiling nanopb Protobuf library as part of C language programs, nested Protobuf messages require use of nanopb defined function type `pb_callback_t` in order to encode and to decode those nested messages.  Some examples of this on github:
 
When compiling nanopb Protobuf library as part of C language programs, nested Protobuf messages require use of nanopb defined function type `pb_callback_t` in order to encode and to decode those nested messages.  Some examples of this on github:

Revision as of 14:46, 6 October 2024

Introduction:

Also a good more detailed introduction:

When compiling nanopb Protobuf library as part of C language programs, nested Protobuf messages require use of nanopb defined function type `pb_callback_t` in order to encode and to decode those nested messages. Some examples of this on github:

In the first example an early on file instance of `pb_callback_t` occurs on line 56. Looking further this project has a few dozen protoc generated files . . . switching to a possible smaller project:

In kitsune project, looking at:

(1) file kitsune/kitsune/audio_features_upload_task.c function setup_protbuf( . . . ) (2) file audio_features_upload_task_helpers.c function encode_repeated_streaming_bytes_and_mark_done(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) (3) in same file reviewing function write_streams(pb_ostream_t *stream, const pb_field_t *field,hlo_stream_t * hlo_stream)


^ References To Sort

Protobuf references, somewhat arbitrary starting point yet introduces some key topics of Protobuf standard and use cases:

JSON supported data types:


First Protobuf .proto file, compiles using `protoc-c`, part of a package available with Ubuntu 20.04:

// syntax = "proto3";
syntax = "proto2";

// Notes:
// $ protoc-c --c_out=. ./first.proto

message sensorUpdates {
  required int32 message_id = 1;
  optional float vrms = 2;
}

. . . It appears that the integer values which message elements are assigned as tantamount to key names in JSON.

^ Nanopb

2022-01-08 Saturday

Cmake script to locate Nanopb headers and sources: