-
Notifications
You must be signed in to change notification settings - Fork 302
/
gatewayserver.pb.setters.fm.go
196 lines (186 loc) · 4.5 KB
/
gatewayserver.pb.setters.fm.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
// Code generated by protoc-gen-fieldmask. DO NOT EDIT.
package ttnpb
import fmt "fmt"
func (dst *GatewayUp) SetFields(src *GatewayUp, paths ...string) error {
for name, subs := range _processPaths(paths) {
switch name {
case "uplink_messages":
if len(subs) > 0 {
return fmt.Errorf("'uplink_messages' has no subfields, but %s were specified", subs)
}
if src != nil {
dst.UplinkMessages = src.UplinkMessages
} else {
dst.UplinkMessages = nil
}
case "gateway_status":
if len(subs) > 0 {
var newDst, newSrc *GatewayStatus
if (src == nil || src.GatewayStatus == nil) && dst.GatewayStatus == nil {
continue
}
if src != nil {
newSrc = src.GatewayStatus
}
if dst.GatewayStatus != nil {
newDst = dst.GatewayStatus
} else {
newDst = &GatewayStatus{}
dst.GatewayStatus = newDst
}
if err := newDst.SetFields(newSrc, subs...); err != nil {
return err
}
} else {
if src != nil {
dst.GatewayStatus = src.GatewayStatus
} else {
dst.GatewayStatus = nil
}
}
case "tx_acknowledgment":
if len(subs) > 0 {
var newDst, newSrc *TxAcknowledgment
if (src == nil || src.TxAcknowledgment == nil) && dst.TxAcknowledgment == nil {
continue
}
if src != nil {
newSrc = src.TxAcknowledgment
}
if dst.TxAcknowledgment != nil {
newDst = dst.TxAcknowledgment
} else {
newDst = &TxAcknowledgment{}
dst.TxAcknowledgment = newDst
}
if err := newDst.SetFields(newSrc, subs...); err != nil {
return err
}
} else {
if src != nil {
dst.TxAcknowledgment = src.TxAcknowledgment
} else {
dst.TxAcknowledgment = nil
}
}
default:
return fmt.Errorf("invalid field: '%s'", name)
}
}
return nil
}
func (dst *GatewayDown) SetFields(src *GatewayDown, paths ...string) error {
for name, subs := range _processPaths(paths) {
switch name {
case "downlink_message":
if len(subs) > 0 {
var newDst, newSrc *DownlinkMessage
if (src == nil || src.DownlinkMessage == nil) && dst.DownlinkMessage == nil {
continue
}
if src != nil {
newSrc = src.DownlinkMessage
}
if dst.DownlinkMessage != nil {
newDst = dst.DownlinkMessage
} else {
newDst = &DownlinkMessage{}
dst.DownlinkMessage = newDst
}
if err := newDst.SetFields(newSrc, subs...); err != nil {
return err
}
} else {
if src != nil {
dst.DownlinkMessage = src.DownlinkMessage
} else {
dst.DownlinkMessage = nil
}
}
default:
return fmt.Errorf("invalid field: '%s'", name)
}
}
return nil
}
func (dst *ScheduleDownlinkResponse) SetFields(src *ScheduleDownlinkResponse, paths ...string) error {
for name, subs := range _processPaths(paths) {
switch name {
case "delay":
if len(subs) > 0 {
return fmt.Errorf("'delay' has no subfields, but %s were specified", subs)
}
if src != nil {
dst.Delay = src.Delay
} else {
dst.Delay = nil
}
case "downlink_path":
if len(subs) > 0 {
var newDst, newSrc *DownlinkPath
if (src == nil || src.DownlinkPath == nil) && dst.DownlinkPath == nil {
continue
}
if src != nil {
newSrc = src.DownlinkPath
}
if dst.DownlinkPath != nil {
newDst = dst.DownlinkPath
} else {
newDst = &DownlinkPath{}
dst.DownlinkPath = newDst
}
if err := newDst.SetFields(newSrc, subs...); err != nil {
return err
}
} else {
if src != nil {
dst.DownlinkPath = src.DownlinkPath
} else {
dst.DownlinkPath = nil
}
}
case "rx1":
if len(subs) > 0 {
return fmt.Errorf("'rx1' has no subfields, but %s were specified", subs)
}
if src != nil {
dst.Rx1 = src.Rx1
} else {
var zero bool
dst.Rx1 = zero
}
case "rx2":
if len(subs) > 0 {
return fmt.Errorf("'rx2' has no subfields, but %s were specified", subs)
}
if src != nil {
dst.Rx2 = src.Rx2
} else {
var zero bool
dst.Rx2 = zero
}
default:
return fmt.Errorf("invalid field: '%s'", name)
}
}
return nil
}
func (dst *ScheduleDownlinkErrorDetails) SetFields(src *ScheduleDownlinkErrorDetails, paths ...string) error {
for name, subs := range _processPaths(paths) {
switch name {
case "path_errors":
if len(subs) > 0 {
return fmt.Errorf("'path_errors' has no subfields, but %s were specified", subs)
}
if src != nil {
dst.PathErrors = src.PathErrors
} else {
dst.PathErrors = nil
}
default:
return fmt.Errorf("invalid field: '%s'", name)
}
}
return nil
}