protocol-buffers

Streaming data with ProtoBuf to log file with a header

徘徊边缘 提交于 2021-01-27 23:18:05
问题 I am trying to stream data to a log file on an SD card on a microcontroller that reads from some sensors and stores the value in the file. To serialize the data I will be using NanoPB, the protobuf implementation for C which is quite resource efficient. The log file has the following structure: It needs to write a short header composed of a GUID, and a firmware version. After the header, the stream of data should be continuous and it should log the fields from the sensors but not the header

Why protobuf only read the last message as input result?

浪尽此生 提交于 2021-01-27 17:45:39
问题 Usually, we use protobuf to communicate a message, for multiple times, each with different message content. But I found seems the reader side process the whole message, and only the last one is used, like below: $cat 30.proto message hello { required int32 f1=1; required int32 f2=2; optional int32 f3=3; } $cat 30.cpp #include "30.pb.h" #include<fstream> #include<iostream> using namespace std; int main() { fstream fo("./log30.data",ios::binary|ios::out); hello p1,p2,p3; p1.set_f1(1); p1.set_f2

Go Protobuf declarations and optional Fields in Go Struct (string pointers)

不打扰是莪最后的温柔 提交于 2021-01-27 14:09:17
问题 I am running into a bit of a problem with Protoc and my existing struct that contains nullable string fields. The struct I am trying to serialize for transmission contains a bunch of fields that are nullable in json (so we can distinguish between null , "" and a set value). type Message struct { Path *string `json:"path"` } So if a user sends a empty json string {} the Path will be nil and not "" , whereas {"path":""} is also valid and a different case from {"path": null} . The proto3

C++ Linux Google Protobuf + boost::asio Cannot Parse

大兔子大兔子 提交于 2021-01-27 12:14:31
问题 I am trying to send a Google Protobuf message over a boost::asio socket via TCP. I recognize that TCP is a streaming protocol and thus I am performing length-prefixing on the messages before they go through the socket. I have the code working, but it only appears to work some of the time, even though I'm repeating the same calls and not changing the environment. On occasion I will receive the following error: [libprotobuf ERROR google/protobuf/message_lite.cc:123] Can't parse message of type

compile protocol buffers 3 timestamp type in c# visual studio?

懵懂的女人 提交于 2021-01-27 10:02:56
问题 Visual Studio 2015 C# NuGet Packages : Google.Protobuf v3.0.0 Google.Protobuf.Tools v3.0.0 MessageType Quake syntax = "proto3"; import "google/protobuf/timestamp.proto"; message Quake { google.protobuf.Timestamp _timestamp = 1; double magnitude = 2; } timestamp.proto included in same folder protoc 3.0.2 command-line compilation succeeds But VS right-click proto file and select "Run Custom Tool" fails with error "The custom tool 'ProtoBufTool' failed." to generate the C# classes from within

compile protocol buffers 3 timestamp type in c# visual studio?

江枫思渺然 提交于 2021-01-27 09:58:48
问题 Visual Studio 2015 C# NuGet Packages : Google.Protobuf v3.0.0 Google.Protobuf.Tools v3.0.0 MessageType Quake syntax = "proto3"; import "google/protobuf/timestamp.proto"; message Quake { google.protobuf.Timestamp _timestamp = 1; double magnitude = 2; } timestamp.proto included in same folder protoc 3.0.2 command-line compilation succeeds But VS right-click proto file and select "Run Custom Tool" fails with error "The custom tool 'ProtoBufTool' failed." to generate the C# classes from within

compile protocol buffers 3 timestamp type in c# visual studio?

杀马特。学长 韩版系。学妹 提交于 2021-01-27 09:55:07
问题 Visual Studio 2015 C# NuGet Packages : Google.Protobuf v3.0.0 Google.Protobuf.Tools v3.0.0 MessageType Quake syntax = "proto3"; import "google/protobuf/timestamp.proto"; message Quake { google.protobuf.Timestamp _timestamp = 1; double magnitude = 2; } timestamp.proto included in same folder protoc 3.0.2 command-line compilation succeeds But VS right-click proto file and select "Run Custom Tool" fails with error "The custom tool 'ProtoBufTool' failed." to generate the C# classes from within

compile protocol buffers 3 timestamp type in c# visual studio?

眉间皱痕 提交于 2021-01-27 09:55:06
问题 Visual Studio 2015 C# NuGet Packages : Google.Protobuf v3.0.0 Google.Protobuf.Tools v3.0.0 MessageType Quake syntax = "proto3"; import "google/protobuf/timestamp.proto"; message Quake { google.protobuf.Timestamp _timestamp = 1; double magnitude = 2; } timestamp.proto included in same folder protoc 3.0.2 command-line compilation succeeds But VS right-click proto file and select "Run Custom Tool" fails with error "The custom tool 'ProtoBufTool' failed." to generate the C# classes from within

compile protocol buffers 3 timestamp type in c# visual studio?

允我心安 提交于 2021-01-27 09:54:31
问题 Visual Studio 2015 C# NuGet Packages : Google.Protobuf v3.0.0 Google.Protobuf.Tools v3.0.0 MessageType Quake syntax = "proto3"; import "google/protobuf/timestamp.proto"; message Quake { google.protobuf.Timestamp _timestamp = 1; double magnitude = 2; } timestamp.proto included in same folder protoc 3.0.2 command-line compilation succeeds But VS right-click proto file and select "Run Custom Tool" fails with error "The custom tool 'ProtoBufTool' failed." to generate the C# classes from within

How to serialize/deserialize Pandas DataFrame to and from ProtoBuf/Gzip in a RESTful Flask App?

牧云@^-^@ 提交于 2021-01-21 01:45:11
问题 I have a pandas dataframe to be returned as a Flask Response object in a flask application. Currently I am converting it to a JSON Object , df = df.to_json() return Response(df, status=200, mimetype='application/json') The dataframe size is really huge of the magnitude, probably 5000000 X 10. On the client side when I deserialize it as, df = response.read_json() As my number of URL request parameters grow, the dataframe grows as well. Deserialization time grows at a linear factor as compared