-
Notifications
You must be signed in to change notification settings - Fork 9
/
ephemeris.go
280 lines (260 loc) · 9.79 KB
/
ephemeris.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
package rtcm3
import (
"encoding/binary"
"github.com/go-restruct/restruct"
)
// GPS Ephemerides
type Message1019 struct {
AbstractMessage
SatelliteID uint8 `struct:"uint8:6"`
WeekNumber uint16 `struct:"uint16:10"`
SVAccuracy uint8 `struct:"uint8:4"`
CodeOnL2 uint8 `struct:"uint8:2"`
IDOT int16 `struct:"int16:14"`
IODE uint8 `struct:"uint8"`
Toc uint16 `struct:"uint16"`
Af2 int8 `struct:"int8"`
Af1 int16 `struct:"int16"`
Af0 int32 `struct:"int32:22"`
IODC uint16 `struct:"uint16:10"`
Crs int16 `struct:"int16"`
DeltaN int16 `struct:"int16"`
M0 int32 `struct:"int32"`
Cuc int16 `struct:"int16"`
Eccentricity uint32 `struct:"uint32"`
Cus int16 `struct:"int16"`
SrA uint32 `struct:"uint32"`
Toe uint16 `struct:"uint16"`
Cic int16 `struct:"int16"`
Omega0 int32 `struct:"int32"`
Cis int16 `struct:"int16"`
I0 int32 `struct:"int32"`
Crc int16 `struct:"int16"`
Perigee int32 `struct:"int32"`
OmegaDot int32 `struct:"int32:24"`
Tgd int8 `struct:"int8"`
SVHealth uint8 `struct:"uint8:6"`
L2PDataFlag bool `struct:"uint8:1,variantbool"`
FitInterval bool `struct:"uint8:1,variantbool"`
}
func DeserializeMessage1019(data []byte) (msg Message1019) {
restruct.Unpack(data, binary.BigEndian, &msg)
return msg
}
func (msg Message1019) Serialize() []byte {
data, _ := restruct.Pack(binary.BigEndian, &msg)
return data
}
type Sint uint
// GLONASS Ephemerides
type Message1020 struct {
AbstractMessage
SatelliteId uint8 `struct:"uint8:6"`
FrequencyChannel uint8 `struct:"uint8:5"`
AlmanacHealth bool `struct:"uint8:1,variantbool"`
AlmanacHealthAvailability bool `struct:"uint8:1,variantbool"`
P1 uint8 `struct:"uint8:2"`
Tk uint16 `struct:"uint16:12"`
Msb bool `struct:"uint8:1,variantbool"`
P2 bool `struct:"uint8:1,variantbool"`
Tb uint8 `struct:"uint8:7"`
XnTb1 Sint `struct:"uint32:24"`
XnTb Sint `struct:"uint32:27"`
XnTb2 Sint `struct:"uint8:5"`
YnTb1 Sint `struct:"uint32:24"`
YnTb Sint `struct:"uint32:27"`
YnTb2 Sint `struct:"uint8:5"`
ZnTb1 Sint `struct:"uint32:24"`
ZnTb Sint `struct:"uint32:27"`
ZnTb2 Sint `struct:"uint8:5"`
P3 bool `struct:"uint8:1,variantbool"`
GammaN Sint `struct:"uint16:11"`
Mp uint8 `struct:"uint8:2"`
M1n3 bool `struct:"uint8:1,variantbool"`
TauN Sint `struct:"uint32:22"`
MDeltaTauN Sint `struct:"uint8:5"`
En uint8 `struct:"uint8:5"`
MP4 bool `struct:"uint8:1,variantbool"`
MFt uint8 `struct:"uint8:4"`
MNt uint16 `struct:"uint16:11"`
MM uint8 `struct:"uint8:2"`
AdditionalData bool `struct:"uint8:1,variantbool"`
Na uint16 `struct:"uint16:11"`
TauC Sint `struct:"uint32"`
MN4 uint8 `struct:"uint8:5"`
MTauGps Sint `struct:"uint32:22"`
M1n5 bool `struct:"uint8:1,variantbool"`
Reserved uint8 `struct:"uint8:7"`
}
func DeserializeMessage1020(data []byte) (msg Message1020) {
restruct.Unpack(data, binary.BigEndian, &msg)
return msg
}
func (msg Message1020) Serialize() []byte {
data, _ := restruct.Pack(binary.BigEndian, &msg)
return data
}
// BDS Satellite Ephemeris Data
type Message1042 struct {
AbstractMessage
SatelliteId uint8 `struct:"uint8:6"`
WeekNumber uint16 `struct:"uint16:13"`
SVURAI uint8 `struct:"uint8:4"`
IDOT int16 `struct:"int16:14"`
AODE uint8 `struct:"uint8:5"`
Toc uint32 `struct:"uint32:17"`
A2 int16 `struct:"int16:11"`
A1 int32 `struct:"int32:22"`
A0 int32 `struct:"int32:24"`
AODC uint8 `struct:"uint8:5"`
Crs int32 `struct:"int32:18"`
DeltaN int16 `struct:"int16"`
M0 int32 `struct:"int32"`
Cuc int32 `struct:"int32:18"`
E uint32 `struct:"uint32"`
Cus int32 `struct:"int32:18"`
ASquared uint32 `struct:"uint32"`
Toe uint32 `struct:"uint32:17"`
Cic int32 `struct:"int32:18"`
Omega0 int32 `struct:"int32"`
Cis int32 `struct:"int32:18"`
I0 int32 `struct:"int32"`
Crc int32 `struct:"int32:18"`
Omega int32 `struct:"int32"`
OmegaDot int32 `struct:"int32:24"`
TGD1 int16 `struct:"int16:10"`
TGD2 int16 `struct:"int16:10"`
SVHealth bool `struct:"uint8:1,variantbool"`
}
func DeserializeMessage1042(data []byte) (msg Message1042) {
restruct.Unpack(data, binary.BigEndian, &msg)
return msg
}
func (msg Message1042) Serialize() []byte {
data, _ := restruct.Pack(binary.BigEndian, &msg)
return data
}
// QZSS Ephemerides
type Message1044 struct {
AbstractMessage
SatelliteId uint8 `struct:"uint8:4"`
Toc uint16 `struct:"uint16"`
Af2 int8 `struct:"int8"`
Af1 int16 `struct:"int16"`
Af0 int32 `struct:"int32:22"`
IODE uint8 `struct:"uint8"`
Crs int16 `struct:"int16"`
DeltaN0 int16 `struct:"int16"`
M0 int32 `struct:"int32"`
Cuc int16 `struct:"int16"`
E uint32 `struct:"uint32"`
Cus int16 `struct:"int16"`
ASquared uint32 `struct:"uint32"`
Toe uint16 `struct:"uint16"`
Cic int16 `struct:"int16"`
Omega0 int32 `struct:"int32"`
Cis int16 `struct:"int16"`
I0 int32 `struct:"int32"`
Crc int16 `struct:"int16"`
OmegaN int32 `struct:"int32"`
OmegaDot int32 `struct:"int32:24"`
I0Dot int16 `struct:"int16:14"`
CodesL2 uint8 `struct:"uint8:2"`
WeekNumber uint16 `struct:"uint16:10"`
URA uint8 `struct:"uint8:4"`
SVHealth uint8 `struct:"uint8:6"`
TGD int8 `struct:"int8"`
IODC uint16 `struct:"uint16:10"`
FitInterval bool `struct:"uint8:1,variantbool"`
}
func DeserializeMessage1044(data []byte) (msg Message1044) {
restruct.Unpack(data, binary.BigEndian, &msg)
return msg
}
func (msg Message1044) Serialize() []byte {
data, _ := restruct.Pack(binary.BigEndian, &msg)
return data
}
// Galileo F/NAV Satellite Ephemeris Data
type Message1045 struct {
AbstractMessage
SatelliteId uint8 `struct:"uint8:6"`
WeekNumber uint16 `struct:"uint16:12"`
IODNav uint16 `struct:"uint16:10"`
SVSISA uint8 `struct:"uint8"`
IDot int16 `struct:"int16:14"`
Toc uint16 `struct:"uint16:14"`
Af2 int8 `struct:"int8:6"`
Af1 int32 `struct:"int32:21"`
Af0 int32 `struct:"int32:31"`
Crs int16 `struct:"int16"`
DeltaN0 int16 `struct:"int16"`
M0 int32 `struct:"int32"`
Cuc int16 `struct:"int16"`
E uint32 `struct:"uint32"`
Cus int16 `struct:"int16"`
ASquared uint32 `struct:"uint32"`
Toe uint16 `struct:"uint16:14"`
Cic int16 `struct:"int16"`
Omega0 int32 `struct:"int32"`
Cis int16 `struct:"int16"`
I0 int32 `struct:"int32"`
Crc int16 `struct:"int16"`
Omega int32 `struct:"int32"`
OmegaDot int32 `struct:"int32:24"`
BGDE5aE1 int16 `struct:"int16:10"`
OSHS uint8 `struct:"uint8:2"`
OSDVS bool `struct:"uint8:1,variantbool"`
Reserved uint8 `struct:"uint8:7"`
}
func DeserializeMessage1045(data []byte) (msg Message1045) {
restruct.Unpack(data, binary.BigEndian, &msg)
return msg
}
func (msg Message1045) Serialize() []byte {
data, _ := restruct.Pack(binary.BigEndian, &msg)
return data
}
// Galileo I/NAV Satellite Ephemeris Data
type Message1046 struct {
AbstractMessage
SatelliteId uint8 `struct:"uint8:6"`
WeekNumber uint16 `struct:"uint16:12"`
IODNav uint16 `struct:"uint16:10"`
SISAIndex uint8 `struct:"uint8"`
IDot int16 `struct:"int16:14"`
Toc uint16 `struct:"uint16:14"`
Af2 int8 `struct:"int8:6"`
Af1 int32 `struct:"int32:21"`
Af0 int32 `struct:"int32:31"`
Crs int16 `struct:"int16"`
DeltaN0 int16 `struct:"int16"`
M0 int32 `struct:"int32"`
Cuc int16 `struct:"int16"`
E uint32 `struct:"uint32"`
Cus int16 `struct:"int16"`
ASquared uint32 `struct:"uint32"`
Toe uint16 `struct:"uint16:14"`
Cic int16 `struct:"int16"`
Omega0 int32 `struct:"int32"`
Cis int16 `struct:"int16"`
I0 int32 `struct:"int32"`
Crc int16 `struct:"int16"`
Omega int32 `struct:"int32"`
OmegaDot int32 `struct:"int32:24"`
BGDE5aE1 int16 `struct:"int16:10"`
BGDE5bE1 int16 `struct:"int16:10"`
E5bSignalHealthStatus uint8 `struct:"uint8:2"`
E5bDataValidityStatus bool `struct:"uint8:1,variantbool"`
E1BSignalHealthStatus uint8 `struct:"uint8:2"`
E2BDataValidityStatus bool `struct:"uint8:1,variantbool"`
Reserved uint8 `struct:"uint8:2"`
}
func DeserializeMessage1046(data []byte) (msg Message1046) {
restruct.Unpack(data, binary.BigEndian, &msg)
return msg
}
func (msg Message1046) Serialize() []byte {
data, _ := restruct.Pack(binary.BigEndian, &msg)
return data
}