-
Notifications
You must be signed in to change notification settings - Fork 302
/
lorawan_json.pb.go
2546 lines (2412 loc) · 73 KB
/
lorawan_json.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by protoc-gen-go-json. DO NOT EDIT.
// versions:
// - protoc-gen-go-json v1.1.0
// - protoc v3.9.1
// source: lorawan-stack/api/lorawan.proto
package ttnpb
import (
gogo "github.com/TheThingsIndustries/protoc-gen-go-json/gogo"
jsonplugin "github.com/TheThingsIndustries/protoc-gen-go-json/jsonplugin"
)
// MarshalProtoJSON marshals the MType to JSON.
func (x MType) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), MType_name)
}
// UnmarshalProtoJSON unmarshals the MType from JSON.
func (x *MType) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(MType_value)
if err := s.Err(); err != nil {
s.SetErrorf("could not read MType enum: %v", err)
return
}
*x = MType(v)
}
// MarshalProtoJSON marshals the Major to JSON.
func (x Major) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), Major_name)
}
// Major_customvalue contains custom string values that extend Major_value.
var Major_customvalue = map[string]int32{
"R1": 0,
}
// UnmarshalProtoJSON unmarshals the Major from JSON.
func (x *Major) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(Major_value, Major_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read Major enum: %v", err)
return
}
*x = Major(v)
}
// MarshalProtoJSON marshals the MACVersion to JSON.
func (x MACVersion) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), MACVersion_name)
}
// MACVersion_customvalue contains custom string values that extend MACVersion_value.
var MACVersion_customvalue = map[string]int32{
"UNKNOWN": 0,
"V1_0": 1,
"V1_0_1": 2,
"V1_0_2": 3,
"V1_1": 4,
"V1_0_3": 5,
"V1_0_4": 6,
}
// UnmarshalProtoJSON unmarshals the MACVersion from JSON.
func (x *MACVersion) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(MACVersion_value, MACVersion_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read MACVersion enum: %v", err)
return
}
*x = MACVersion(v)
}
// PHYVersion_customname contains custom string values that override PHYVersion_name.
var PHYVersion_customname = map[int32]string{
0: "unknown",
1: "PHY_V1_0",
2: "PHY_V1_0_1",
3: "PHY_V1_0_2_REV_A",
4: "PHY_V1_0_2_REV_B",
5: "PHY_V1_1_REV_A",
6: "PHY_V1_1_REV_B",
7: "PHY_V1_0_3_REV_A",
}
// MarshalProtoJSON marshals the PHYVersion to JSON.
func (x PHYVersion) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), PHYVersion_customname, PHYVersion_name)
}
// PHYVersion_customvalue contains custom string values that extend PHYVersion_value.
var PHYVersion_customvalue = map[string]int32{
"UNKNOWN": 0,
"unknown": 0,
"PHY_V1_0": 1,
"1.0": 1,
"1.0.0": 1,
"PHY_V1_0_1": 2,
"1.0.1": 2,
"PHY_V1_0_2_REV_A": 3,
"1.0.2": 3,
"1.0.2-a": 3,
"PHY_V1_0_2_REV_B": 4,
"1.0.2-b": 4,
"PHY_V1_1_REV_A": 5,
"1.1-a": 5,
"1.1.0-a": 5,
"PHY_V1_1_REV_B": 6,
"1.1-b": 6,
"1.1.0-b": 6,
"PHY_V1_0_3_REV_A": 7,
"1.0.3-a": 7,
}
// UnmarshalProtoJSON unmarshals the PHYVersion from JSON.
func (x *PHYVersion) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(PHYVersion_value, PHYVersion_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read PHYVersion enum: %v", err)
return
}
*x = PHYVersion(v)
}
// MarshalProtoJSON marshals the DataRateIndex to JSON.
func (x DataRateIndex) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumNumber(int32(x))
}
// DataRateIndex_customvalue contains custom string values that extend DataRateIndex_value.
var DataRateIndex_customvalue = map[string]int32{
"0": 0,
"1": 1,
"2": 2,
"3": 3,
"4": 4,
"5": 5,
"6": 6,
"7": 7,
"8": 8,
"9": 9,
"10": 10,
"11": 11,
"12": 12,
"13": 13,
"14": 14,
"15": 15,
}
// UnmarshalProtoJSON unmarshals the DataRateIndex from JSON.
func (x *DataRateIndex) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(DataRateIndex_value, DataRateIndex_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read DataRateIndex enum: %v", err)
return
}
*x = DataRateIndex(v)
}
// MarshalProtoJSON marshals the DataRateOffset to JSON.
func (x DataRateOffset) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumNumber(int32(x))
}
// DataRateOffset_customvalue contains custom string values that extend DataRateOffset_value.
var DataRateOffset_customvalue = map[string]int32{
"0": 0,
"1": 1,
"2": 2,
"3": 3,
"4": 4,
"5": 5,
"6": 6,
"7": 7,
}
// UnmarshalProtoJSON unmarshals the DataRateOffset from JSON.
func (x *DataRateOffset) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(DataRateOffset_value, DataRateOffset_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read DataRateOffset enum: %v", err)
return
}
*x = DataRateOffset(v)
}
// MarshalProtoJSON marshals the JoinRequestType to JSON.
func (x JoinRequestType) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), JoinRequestType_name)
}
// UnmarshalProtoJSON unmarshals the JoinRequestType from JSON.
func (x *JoinRequestType) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(JoinRequestType_value)
if err := s.Err(); err != nil {
s.SetErrorf("could not read JoinRequestType enum: %v", err)
return
}
*x = JoinRequestType(v)
}
// MarshalProtoJSON marshals the RejoinRequestType to JSON.
func (x RejoinRequestType) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), RejoinRequestType_name)
}
// UnmarshalProtoJSON unmarshals the RejoinRequestType from JSON.
func (x *RejoinRequestType) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(RejoinRequestType_value)
if err := s.Err(); err != nil {
s.SetErrorf("could not read RejoinRequestType enum: %v", err)
return
}
*x = RejoinRequestType(v)
}
// MarshalProtoJSON marshals the CFListType to JSON.
func (x CFListType) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), CFListType_name)
}
// UnmarshalProtoJSON unmarshals the CFListType from JSON.
func (x *CFListType) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(CFListType_value)
if err := s.Err(); err != nil {
s.SetErrorf("could not read CFListType enum: %v", err)
return
}
*x = CFListType(v)
}
// MarshalProtoJSON marshals the Class to JSON.
func (x Class) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), Class_name)
}
// Class_customvalue contains custom string values that extend Class_value.
var Class_customvalue = map[string]int32{
"A": 0,
"B": 1,
"C": 2,
}
// UnmarshalProtoJSON unmarshals the Class from JSON.
func (x *Class) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(Class_value, Class_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read Class enum: %v", err)
return
}
*x = Class(v)
}
// MarshalProtoJSON marshals the TxSchedulePriority to JSON.
func (x TxSchedulePriority) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), TxSchedulePriority_name)
}
// UnmarshalProtoJSON unmarshals the TxSchedulePriority from JSON.
func (x *TxSchedulePriority) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(TxSchedulePriority_value)
if err := s.Err(); err != nil {
s.SetErrorf("could not read TxSchedulePriority enum: %v", err)
return
}
*x = TxSchedulePriority(v)
}
// MarshalProtoJSON marshals the MACCommandIdentifier to JSON.
func (x MACCommandIdentifier) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), MACCommandIdentifier_name)
}
// MACCommandIdentifier_customvalue contains custom string values that extend MACCommandIdentifier_value.
var MACCommandIdentifier_customvalue = map[string]int32{
"RFU_0": 0,
"RESET": 1,
"LINK_CHECK": 2,
"LINK_ADR": 3,
"DUTY_CYCLE": 4,
"RX_PARAM_SETUP": 5,
"DEV_STATUS": 6,
"NEW_CHANNEL": 7,
"RX_TIMING_SETUP": 8,
"TX_PARAM_SETUP": 9,
"DL_CHANNEL": 10,
"REKEY": 11,
"ADR_PARAM_SETUP": 12,
"DEVICE_TIME": 13,
"FORCE_REJOIN": 14,
"REJOIN_PARAM_SETUP": 15,
"PING_SLOT_INFO": 16,
"PING_SLOT_CHANNEL": 17,
"BEACON_TIMING": 18,
"BEACON_FREQ": 19,
"DEVICE_MODE": 32,
}
// UnmarshalProtoJSON unmarshals the MACCommandIdentifier from JSON.
func (x *MACCommandIdentifier) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(MACCommandIdentifier_value, MACCommandIdentifier_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read MACCommandIdentifier enum: %v", err)
return
}
*x = MACCommandIdentifier(v)
}
// MarshalProtoJSON marshals the AggregatedDutyCycle to JSON.
func (x AggregatedDutyCycle) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), AggregatedDutyCycle_name)
}
// AggregatedDutyCycle_customvalue contains custom string values that extend AggregatedDutyCycle_value.
var AggregatedDutyCycle_customvalue = map[string]int32{
"1": 0,
"2": 1,
"4": 2,
"8": 3,
"16": 4,
"32": 5,
"64": 6,
"128": 7,
"256": 8,
"512": 9,
"1024": 10,
"2048": 11,
"4096": 12,
"8192": 13,
"16384": 14,
"32768": 15,
}
// UnmarshalProtoJSON unmarshals the AggregatedDutyCycle from JSON.
func (x *AggregatedDutyCycle) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(AggregatedDutyCycle_value, AggregatedDutyCycle_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read AggregatedDutyCycle enum: %v", err)
return
}
*x = AggregatedDutyCycle(v)
}
// MarshalProtoJSON marshals the PingSlotPeriod to JSON.
func (x PingSlotPeriod) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), PingSlotPeriod_name)
}
// PingSlotPeriod_customvalue contains custom string values that extend PingSlotPeriod_value.
var PingSlotPeriod_customvalue = map[string]int32{
"1S": 0,
"2S": 1,
"4S": 2,
"8S": 3,
"16S": 4,
"32S": 5,
"64S": 6,
"128S": 7,
}
// UnmarshalProtoJSON unmarshals the PingSlotPeriod from JSON.
func (x *PingSlotPeriod) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(PingSlotPeriod_value, PingSlotPeriod_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read PingSlotPeriod enum: %v", err)
return
}
*x = PingSlotPeriod(v)
}
// MarshalProtoJSON marshals the RejoinCountExponent to JSON.
func (x RejoinCountExponent) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), RejoinCountExponent_name)
}
// RejoinCountExponent_customvalue contains custom string values that extend RejoinCountExponent_value.
var RejoinCountExponent_customvalue = map[string]int32{
"16": 0,
"32": 1,
"64": 2,
"128": 3,
"256": 4,
"512": 5,
"1024": 6,
"2048": 7,
"4096": 8,
"8192": 9,
"16384": 10,
"32768": 11,
"65536": 12,
"131072": 13,
"262144": 14,
"524288": 15,
}
// UnmarshalProtoJSON unmarshals the RejoinCountExponent from JSON.
func (x *RejoinCountExponent) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(RejoinCountExponent_value, RejoinCountExponent_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read RejoinCountExponent enum: %v", err)
return
}
*x = RejoinCountExponent(v)
}
// MarshalProtoJSON marshals the RejoinTimeExponent to JSON.
func (x RejoinTimeExponent) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), RejoinTimeExponent_name)
}
// RejoinTimeExponent_customvalue contains custom string values that extend RejoinTimeExponent_value.
var RejoinTimeExponent_customvalue = map[string]int32{
"0": 0,
"1": 1,
"2": 2,
"3": 3,
"4": 4,
"5": 5,
"6": 6,
"7": 7,
"8": 8,
"9": 9,
"10": 10,
"11": 11,
"12": 12,
"13": 13,
"14": 14,
"15": 15,
}
// UnmarshalProtoJSON unmarshals the RejoinTimeExponent from JSON.
func (x *RejoinTimeExponent) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(RejoinTimeExponent_value, RejoinTimeExponent_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read RejoinTimeExponent enum: %v", err)
return
}
*x = RejoinTimeExponent(v)
}
// MarshalProtoJSON marshals the RejoinPeriodExponent to JSON.
func (x RejoinPeriodExponent) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), RejoinPeriodExponent_name)
}
// RejoinPeriodExponent_customvalue contains custom string values that extend RejoinPeriodExponent_value.
var RejoinPeriodExponent_customvalue = map[string]int32{
"0": 0,
"1": 1,
"2": 2,
"3": 3,
"4": 4,
"5": 5,
"6": 6,
"7": 7,
}
// UnmarshalProtoJSON unmarshals the RejoinPeriodExponent from JSON.
func (x *RejoinPeriodExponent) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(RejoinPeriodExponent_value, RejoinPeriodExponent_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read RejoinPeriodExponent enum: %v", err)
return
}
*x = RejoinPeriodExponent(v)
}
// MarshalProtoJSON marshals the DeviceEIRP to JSON.
func (x DeviceEIRP) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), DeviceEIRP_name)
}
// DeviceEIRP_customvalue contains custom string values that extend DeviceEIRP_value.
var DeviceEIRP_customvalue = map[string]int32{
"8": 0,
"10": 1,
"12": 2,
"13": 3,
"14": 4,
"16": 5,
"18": 6,
"20": 7,
"21": 8,
"24": 9,
"26": 10,
"27": 11,
"29": 12,
"30": 13,
"33": 14,
"36": 15,
}
// UnmarshalProtoJSON unmarshals the DeviceEIRP from JSON.
func (x *DeviceEIRP) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(DeviceEIRP_value, DeviceEIRP_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read DeviceEIRP enum: %v", err)
return
}
*x = DeviceEIRP(v)
}
// MarshalProtoJSON marshals the ADRAckLimitExponent to JSON.
func (x ADRAckLimitExponent) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), ADRAckLimitExponent_name)
}
// ADRAckLimitExponent_customvalue contains custom string values that extend ADRAckLimitExponent_value.
var ADRAckLimitExponent_customvalue = map[string]int32{
"1": 0,
"2": 1,
"4": 2,
"8": 3,
"16": 4,
"32": 5,
"64": 6,
"128": 7,
"256": 8,
"512": 9,
"1024": 10,
"2048": 11,
"4096": 12,
"8192": 13,
"16384": 14,
"32768": 15,
}
// UnmarshalProtoJSON unmarshals the ADRAckLimitExponent from JSON.
func (x *ADRAckLimitExponent) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(ADRAckLimitExponent_value, ADRAckLimitExponent_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read ADRAckLimitExponent enum: %v", err)
return
}
*x = ADRAckLimitExponent(v)
}
// MarshalProtoJSON marshals the ADRAckDelayExponent to JSON.
func (x ADRAckDelayExponent) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), ADRAckDelayExponent_name)
}
// ADRAckDelayExponent_customvalue contains custom string values that extend ADRAckDelayExponent_value.
var ADRAckDelayExponent_customvalue = map[string]int32{
"1": 0,
"2": 1,
"4": 2,
"8": 3,
"16": 4,
"32": 5,
"64": 6,
"128": 7,
"256": 8,
"512": 9,
"1024": 10,
"2048": 11,
"4096": 12,
"8192": 13,
"16384": 14,
"32768": 15,
}
// UnmarshalProtoJSON unmarshals the ADRAckDelayExponent from JSON.
func (x *ADRAckDelayExponent) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(ADRAckDelayExponent_value, ADRAckDelayExponent_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read ADRAckDelayExponent enum: %v", err)
return
}
*x = ADRAckDelayExponent(v)
}
// MarshalProtoJSON marshals the RxDelay to JSON.
func (x RxDelay) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumNumber(int32(x))
}
// RxDelay_customvalue contains custom string values that extend RxDelay_value.
var RxDelay_customvalue = map[string]int32{
"0": 0,
"1": 1,
"2": 2,
"3": 3,
"4": 4,
"5": 5,
"6": 6,
"7": 7,
"8": 8,
"9": 9,
"10": 10,
"11": 11,
"12": 12,
"13": 13,
"14": 14,
"15": 15,
}
// UnmarshalProtoJSON unmarshals the RxDelay from JSON.
func (x *RxDelay) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(RxDelay_value, RxDelay_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read RxDelay enum: %v", err)
return
}
*x = RxDelay(v)
}
// MarshalProtoJSON marshals the Minor to JSON.
func (x Minor) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), Minor_name)
}
// Minor_customvalue contains custom string values that extend Minor_value.
var Minor_customvalue = map[string]int32{
"RFU_0": 0,
"1": 1,
"RFU_2": 2,
"RFU_3": 3,
"RFU_4": 4,
"RFU_5": 5,
"RFU_6": 6,
"RFU_7": 7,
"RFU_8": 8,
"RFU_9": 9,
"RFU_10": 10,
"RFU_11": 11,
"RFU_12": 12,
"RFU_13": 13,
"RFU_14": 14,
"RFU_15": 15,
}
// UnmarshalProtoJSON unmarshals the Minor from JSON.
func (x *Minor) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(Minor_value, Minor_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read Minor enum: %v", err)
return
}
*x = Minor(v)
}
// MarshalProtoJSON marshals the Message message to JSON.
func (x *Message) MarshalProtoJSON(s *jsonplugin.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if true { // (gogoproto.nullable) = false
s.WriteMoreIf(&wroteField)
s.WriteObjectField("m_hdr")
x.MHDR.MarshalProtoJSON(s.WithField("m_hdr"))
}
if len(x.Mic) > 0 || s.HasField("mic") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("mic")
s.WriteBytes(x.Mic)
}
if x.Payload != nil {
switch ov := x.Payload.(type) {
case *Message_MacPayload:
s.WriteMoreIf(&wroteField)
s.WriteObjectField("mac_payload")
// NOTE: MACPayload does not seem to implement MarshalProtoJSON.
gogo.MarshalMessage(s, ov.MacPayload)
case *Message_JoinRequestPayload:
s.WriteMoreIf(&wroteField)
s.WriteObjectField("join_request_payload")
// NOTE: JoinRequestPayload does not seem to implement MarshalProtoJSON.
gogo.MarshalMessage(s, ov.JoinRequestPayload)
case *Message_JoinAcceptPayload:
s.WriteMoreIf(&wroteField)
s.WriteObjectField("join_accept_payload")
ov.JoinAcceptPayload.MarshalProtoJSON(s.WithField("join_accept_payload"))
case *Message_RejoinRequestPayload:
s.WriteMoreIf(&wroteField)
s.WriteObjectField("rejoin_request_payload")
ov.RejoinRequestPayload.MarshalProtoJSON(s.WithField("rejoin_request_payload"))
}
}
s.WriteObjectEnd()
}
// UnmarshalProtoJSON unmarshals the Message message from JSON.
func (x *Message) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.ReadAny() // ignore unknown field
case "m_hdr", "mHdr":
if !s.ReadNil() {
x.MHDR.UnmarshalProtoJSON(s.WithField("m_hdr", true))
}
case "mic":
s.AddField("mic")
x.Mic = s.ReadBytes()
case "mac_payload", "macPayload":
s.AddField("mac_payload")
ov := &Message_MacPayload{}
// NOTE: MACPayload does not seem to implement UnmarshalProtoJSON.
var v MACPayload
gogo.UnmarshalMessage(s, &v)
ov.MacPayload = &v
x.Payload = ov
case "join_request_payload", "joinRequestPayload":
s.AddField("join_request_payload")
ov := &Message_JoinRequestPayload{}
// NOTE: JoinRequestPayload does not seem to implement UnmarshalProtoJSON.
var v JoinRequestPayload
gogo.UnmarshalMessage(s, &v)
ov.JoinRequestPayload = &v
x.Payload = ov
case "join_accept_payload", "joinAcceptPayload":
ov := &Message_JoinAcceptPayload{}
if !s.ReadNil() {
ov.JoinAcceptPayload = &JoinAcceptPayload{}
ov.JoinAcceptPayload.UnmarshalProtoJSON(s.WithField("join_accept_payload", true))
}
x.Payload = ov
case "rejoin_request_payload", "rejoinRequestPayload":
ov := &Message_RejoinRequestPayload{}
if !s.ReadNil() {
ov.RejoinRequestPayload = &RejoinRequestPayload{}
ov.RejoinRequestPayload.UnmarshalProtoJSON(s.WithField("rejoin_request_payload", true))
}
x.Payload = ov
}
})
}
// MarshalProtoJSON marshals the MHDR message to JSON.
func (x *MHDR) MarshalProtoJSON(s *jsonplugin.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if x.MType != 0 || s.HasField("m_type") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("m_type")
x.MType.MarshalProtoJSON(s)
}
if x.Major != 0 || s.HasField("major") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("major")
x.Major.MarshalProtoJSON(s)
}
s.WriteObjectEnd()
}
// UnmarshalProtoJSON unmarshals the MHDR message from JSON.
func (x *MHDR) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.ReadAny() // ignore unknown field
case "m_type", "mType":
s.AddField("m_type")
x.MType.UnmarshalProtoJSON(s)
case "major":
s.AddField("major")
x.Major.UnmarshalProtoJSON(s)
}
})
}
// MarshalProtoJSON marshals the RejoinRequestPayload message to JSON.
func (x *RejoinRequestPayload) MarshalProtoJSON(s *jsonplugin.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if x.RejoinType != 0 || s.HasField("rejoin_type") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("rejoin_type")
x.RejoinType.MarshalProtoJSON(s)
}
if len(x.NetId) > 0 || s.HasField("net_id") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("net_id")
x.NetId.MarshalProtoJSON(s.WithField("net_id"))
}
if len(x.JoinEui) > 0 || s.HasField("join_eui") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("join_eui")
x.JoinEui.MarshalProtoJSON(s.WithField("join_eui"))
}
if len(x.DevEui) > 0 || s.HasField("dev_eui") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("dev_eui")
x.DevEui.MarshalProtoJSON(s.WithField("dev_eui"))
}
if x.RejoinCnt != 0 || s.HasField("rejoin_cnt") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("rejoin_cnt")
s.WriteUint32(x.RejoinCnt)
}
s.WriteObjectEnd()
}
// UnmarshalProtoJSON unmarshals the RejoinRequestPayload message from JSON.
func (x *RejoinRequestPayload) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.ReadAny() // ignore unknown field
case "rejoin_type", "rejoinType":
s.AddField("rejoin_type")
x.RejoinType.UnmarshalProtoJSON(s)
case "net_id", "netId":
s.AddField("net_id")
x.NetId.UnmarshalProtoJSON(s.WithField("net_id", false))
case "join_eui", "joinEui":
s.AddField("join_eui")
x.JoinEui.UnmarshalProtoJSON(s.WithField("join_eui", false))
case "dev_eui", "devEui":
s.AddField("dev_eui")
x.DevEui.UnmarshalProtoJSON(s.WithField("dev_eui", false))
case "rejoin_cnt", "rejoinCnt":
s.AddField("rejoin_cnt")
x.RejoinCnt = s.ReadUint32()
}
})
}
// MarshalProtoJSON marshals the JoinAcceptPayload message to JSON.
func (x *JoinAcceptPayload) MarshalProtoJSON(s *jsonplugin.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if len(x.Encrypted) > 0 || s.HasField("encrypted") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("encrypted")
s.WriteBytes(x.Encrypted)
}
if len(x.JoinNonce) > 0 || s.HasField("join_nonce") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("join_nonce")
x.JoinNonce.MarshalProtoJSON(s.WithField("join_nonce"))
}
if len(x.NetId) > 0 || s.HasField("net_id") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("net_id")
x.NetId.MarshalProtoJSON(s.WithField("net_id"))
}
if len(x.DevAddr) > 0 || s.HasField("dev_addr") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("dev_addr")
x.DevAddr.MarshalProtoJSON(s.WithField("dev_addr"))
}
if true { // (gogoproto.nullable) = false
s.WriteMoreIf(&wroteField)
s.WriteObjectField("dl_settings")
x.DLSettings.MarshalProtoJSON(s.WithField("dl_settings"))
}
if x.RxDelay != 0 || s.HasField("rx_delay") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("rx_delay")
x.RxDelay.MarshalProtoJSON(s)
}
if x.CfList != nil || s.HasField("cf_list") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("cf_list")
x.CfList.MarshalProtoJSON(s.WithField("cf_list"))
}
s.WriteObjectEnd()
}
// UnmarshalProtoJSON unmarshals the JoinAcceptPayload message from JSON.
func (x *JoinAcceptPayload) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.ReadAny() // ignore unknown field
case "encrypted":
s.AddField("encrypted")
x.Encrypted = s.ReadBytes()
case "join_nonce", "joinNonce":
s.AddField("join_nonce")
x.JoinNonce.UnmarshalProtoJSON(s.WithField("join_nonce", false))
case "net_id", "netId":
s.AddField("net_id")
x.NetId.UnmarshalProtoJSON(s.WithField("net_id", false))
case "dev_addr", "devAddr":
s.AddField("dev_addr")
x.DevAddr.UnmarshalProtoJSON(s.WithField("dev_addr", false))
case "dl_settings", "dlSettings":
if !s.ReadNil() {
x.DLSettings.UnmarshalProtoJSON(s.WithField("dl_settings", true))
}
case "rx_delay", "rxDelay":
s.AddField("rx_delay")
x.RxDelay.UnmarshalProtoJSON(s)
case "cf_list", "cfList":
if !s.ReadNil() {
x.CfList = &CFList{}
x.CfList.UnmarshalProtoJSON(s.WithField("cf_list", true))
}
}
})
}
// MarshalProtoJSON marshals the DLSettings message to JSON.
func (x *DLSettings) MarshalProtoJSON(s *jsonplugin.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if x.Rx1DrOffset != 0 || s.HasField("rx1_dr_offset") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("rx1_dr_offset")
x.Rx1DrOffset.MarshalProtoJSON(s)
}
if x.Rx2Dr != 0 || s.HasField("rx2_dr") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("rx2_dr")
x.Rx2Dr.MarshalProtoJSON(s)
}
if x.OptNeg || s.HasField("opt_neg") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("opt_neg")
s.WriteBool(x.OptNeg)
}
s.WriteObjectEnd()
}
// UnmarshalProtoJSON unmarshals the DLSettings message from JSON.
func (x *DLSettings) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.ReadAny() // ignore unknown field
case "rx1_dr_offset", "rx1DrOffset":
s.AddField("rx1_dr_offset")
x.Rx1DrOffset.UnmarshalProtoJSON(s)
case "rx2_dr", "rx2Dr":
s.AddField("rx2_dr")
x.Rx2Dr.UnmarshalProtoJSON(s)
case "opt_neg", "optNeg":
s.AddField("opt_neg")
x.OptNeg = s.ReadBool()
}
})
}
// MarshalProtoJSON marshals the CFList message to JSON.
func (x *CFList) MarshalProtoJSON(s *jsonplugin.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if x.Type != 0 || s.HasField("type") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("type")
x.Type.MarshalProtoJSON(s)
}
if len(x.Freq) > 0 || s.HasField("freq") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("freq")
s.WriteUint32Array(x.Freq)
}
if len(x.ChMasks) > 0 || s.HasField("ch_masks") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("ch_masks")
s.WriteBoolArray(x.ChMasks)
}
s.WriteObjectEnd()
}
// UnmarshalProtoJSON unmarshals the CFList message from JSON.
func (x *CFList) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
if s.ReadNil() {