1syntax = "proto2"; 2 3import 'nanopb.proto'; 4 5message SubMessage 6{ 7 repeated int32 array = 1 [(nanopb).max_count = 8]; 8} 9 10message OneOfMessage 11{ 12 required int32 prefix = 1; 13 oneof values 14 { 15 int32 first = 5; 16 string second = 6 [(nanopb).max_size = 8]; 17 SubMessage third = 7; 18 } 19 required int32 suffix = 99; 20} 21 22message topMessage { 23 required int32 start = 1; 24 oneof msg { 25 MyMessage1 msg1 = 2; 26 MyMessage2 msg2 = 3; 27 } 28 required int32 end = 4; 29} 30 31message MyMessage1 { 32 required uint32 n1 = 1; 33 required uint32 n2 = 2; 34 required string s = 3 [(nanopb).max_size = 32]; 35} 36 37message MyMessage2 { 38 required uint32 num = 1; 39 required bool b = 2; 40} 41 42message MyMessage3 { 43 required bool bbb = 1; 44 required string ss = 2 [(nanopb).max_size = 1]; 45} 46 47message MyMessage4 { 48 required bool bbbb = 1; 49 required string sss = 2 [(nanopb).max_size = 2]; 50 required uint32 num = 3; 51 required uint32 num2 = 4; 52} 53