mirror of
https://github.com/google/pebble.git
synced 2025-06-23 09:36:17 +00:00
Import of the watch repository from Pebble
This commit is contained in:
commit
3b92768480
10334 changed files with 2564465 additions and 0 deletions
32
third_party/nanopb/examples/using_union_messages/unionproto.proto
vendored
Normal file
32
third_party/nanopb/examples/using_union_messages/unionproto.proto
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
// This is an example of how to handle 'union' style messages
|
||||
// with nanopb, without allocating memory for all the message types.
|
||||
//
|
||||
// There is no official type in Protocol Buffers for describing unions,
|
||||
// but they are commonly implemented by filling out exactly one of
|
||||
// several optional fields.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
message MsgType1
|
||||
{
|
||||
required int32 value = 1;
|
||||
}
|
||||
|
||||
message MsgType2
|
||||
{
|
||||
required bool value = 1;
|
||||
}
|
||||
|
||||
message MsgType3
|
||||
{
|
||||
required int32 value1 = 1;
|
||||
required int32 value2 = 2;
|
||||
}
|
||||
|
||||
message UnionMessage
|
||||
{
|
||||
optional MsgType1 msg1 = 1;
|
||||
optional MsgType2 msg2 = 2;
|
||||
optional MsgType3 msg3 = 3;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue