/
SDORequest.go
215 lines (187 loc) · 5.38 KB
/
SDORequest.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
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
package fbs
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type SDORequestT struct {
AddressType Addresstype
Address uint16
ObjectIndex uint16
SubIndex byte
Flags SDOFlags
Data []byte
MaxLength uint32
}
func (t *SDORequestT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
if t == nil { return 0 }
dataOffset := flatbuffers.UOffsetT(0)
if t.Data != nil {
dataOffset = builder.CreateByteString(t.Data)
}
SDORequestStart(builder)
SDORequestAddAddressType(builder, t.AddressType)
SDORequestAddAddress(builder, t.Address)
SDORequestAddObjectIndex(builder, t.ObjectIndex)
SDORequestAddSubIndex(builder, t.SubIndex)
SDORequestAddFlags(builder, t.Flags)
SDORequestAddData(builder, dataOffset)
SDORequestAddMaxLength(builder, t.MaxLength)
return SDORequestEnd(builder)
}
func (rcv *SDORequest) UnPackTo(t *SDORequestT) {
t.AddressType = rcv.AddressType()
t.Address = rcv.Address()
t.ObjectIndex = rcv.ObjectIndex()
t.SubIndex = rcv.SubIndex()
t.Flags = rcv.Flags()
t.Data = rcv.DataBytes()
t.MaxLength = rcv.MaxLength()
}
func (rcv *SDORequest) UnPack() *SDORequestT {
if rcv == nil { return nil }
t := &SDORequestT{}
rcv.UnPackTo(t)
return t
}
type SDORequest struct {
_tab flatbuffers.Table
}
func GetRootAsSDORequest(buf []byte, offset flatbuffers.UOffsetT) *SDORequest {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &SDORequest{}
x.Init(buf, n+offset)
return x
}
func GetSizePrefixedRootAsSDORequest(buf []byte, offset flatbuffers.UOffsetT) *SDORequest {
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
x := &SDORequest{}
x.Init(buf, n+offset+flatbuffers.SizeUint32)
return x
}
func (rcv *SDORequest) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *SDORequest) Table() flatbuffers.Table {
return rcv._tab
}
func (rcv *SDORequest) AddressType() Addresstype {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return Addresstype(rcv._tab.GetByte(o + rcv._tab.Pos))
}
return 0
}
func (rcv *SDORequest) MutateAddressType(n Addresstype) bool {
return rcv._tab.MutateByteSlot(4, byte(n))
}
func (rcv *SDORequest) Address() uint16 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
return rcv._tab.GetUint16(o + rcv._tab.Pos)
}
return 0
}
func (rcv *SDORequest) MutateAddress(n uint16) bool {
return rcv._tab.MutateUint16Slot(6, n)
}
func (rcv *SDORequest) ObjectIndex() uint16 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
return rcv._tab.GetUint16(o + rcv._tab.Pos)
}
return 0
}
func (rcv *SDORequest) MutateObjectIndex(n uint16) bool {
return rcv._tab.MutateUint16Slot(8, n)
}
func (rcv *SDORequest) SubIndex() byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
return rcv._tab.GetByte(o + rcv._tab.Pos)
}
return 0
}
func (rcv *SDORequest) MutateSubIndex(n byte) bool {
return rcv._tab.MutateByteSlot(10, n)
}
func (rcv *SDORequest) Flags() SDOFlags {
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
return SDOFlags(rcv._tab.GetUint32(o + rcv._tab.Pos))
}
return 0
}
func (rcv *SDORequest) MutateFlags(n SDOFlags) bool {
return rcv._tab.MutateUint32Slot(12, uint32(n))
}
func (rcv *SDORequest) Data(j int) byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.GetByte(a + flatbuffers.UOffsetT(j*1))
}
return 0
}
func (rcv *SDORequest) DataLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
func (rcv *SDORequest) DataBytes() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
func (rcv *SDORequest) MutateData(j int, n byte) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.MutateByte(a+flatbuffers.UOffsetT(j*1), n)
}
return false
}
func (rcv *SDORequest) MaxLength() uint32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(16))
if o != 0 {
return rcv._tab.GetUint32(o + rcv._tab.Pos)
}
return 0
}
func (rcv *SDORequest) MutateMaxLength(n uint32) bool {
return rcv._tab.MutateUint32Slot(16, n)
}
func SDORequestStart(builder *flatbuffers.Builder) {
builder.StartObject(7)
}
func SDORequestAddAddressType(builder *flatbuffers.Builder, addressType Addresstype) {
builder.PrependByteSlot(0, byte(addressType), 0)
}
func SDORequestAddAddress(builder *flatbuffers.Builder, address uint16) {
builder.PrependUint16Slot(1, address, 0)
}
func SDORequestAddObjectIndex(builder *flatbuffers.Builder, objectIndex uint16) {
builder.PrependUint16Slot(2, objectIndex, 0)
}
func SDORequestAddSubIndex(builder *flatbuffers.Builder, subIndex byte) {
builder.PrependByteSlot(3, subIndex, 0)
}
func SDORequestAddFlags(builder *flatbuffers.Builder, flags SDOFlags) {
builder.PrependUint32Slot(4, uint32(flags), 0)
}
func SDORequestAddData(builder *flatbuffers.Builder, data flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(5, flatbuffers.UOffsetT(data), 0)
}
func SDORequestStartDataVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(1, numElems, 1)
}
func SDORequestAddMaxLength(builder *flatbuffers.Builder, maxLength uint32) {
builder.PrependUint32Slot(6, maxLength, 0)
}
func SDORequestEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}