Add 'CAN-binder/libs/nanopb/' from commit '278ffb890e3d8722e4c7d824baaf221a1e375fc4'
[apps/agl-service-can-low-level.git] / CAN-binder / libs / nanopb / examples / using_union_messages / unionproto.proto
1 // This is an example of how to handle 'union' style messages
2 // with nanopb, without allocating memory for all the message types.
3 //
4 // There is no official type in Protocol Buffers for describing unions,
5 // but they are commonly implemented by filling out exactly one of
6 // several optional fields.
7
8 syntax = "proto2";
9
10 message MsgType1
11 {
12     required int32 value = 1;
13 }
14
15 message MsgType2
16 {
17     required bool value = 1;
18 }
19
20 message MsgType3
21 {
22     required int32 value1 = 1;
23     required int32 value2 = 2;
24 }
25
26 message UnionMessage
27 {
28     optional MsgType1 msg1 = 1;
29     optional MsgType2 msg2 = 2;
30     optional MsgType3 msg3 = 3;
31 }
32