-
Notifications
You must be signed in to change notification settings - Fork 9
/
residual.go
82 lines (72 loc) · 2.38 KB
/
residual.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
package rtcm3
import (
"encoding/binary"
"github.com/go-restruct/restruct"
)
// GPS Network RTK Residual Message
type Message1030 struct {
AbstractMessage
Epoch uint32 `struct:"uint32:20"`
ReferenceStationId uint16 `struct:"uint16:12"`
NRefs uint8 `struct:"uint8:7"`
Satellites uint8 `struct:"uint8:5,sizeof=SatelliteData"`
SatelliteData []struct {
SatelliteId uint8 `struct:"uint8:6"`
Soc uint8 `struct:"uint8"`
Sod uint16 `struct:"uint16:9"`
Soh uint8 `struct:"uint8:6"`
SIc uint16 `struct:"uint16:10"`
SId uint16 `struct:"uint16:10"`
}
}
func DeserializeMessage1030(data []byte) (msg Message1030) {
restruct.Unpack(data, binary.BigEndian, &msg)
return msg
}
func (msg Message1030) Serialize() []byte {
data, _ := restruct.Pack(binary.BigEndian, &msg)
return data
}
// TODO: Implement a Time method for GLONASS Residuals Epoch Time - DF225
// GLONASS Network RTK Residual Message
type Message1031 struct {
AbstractMessage
Epoch uint32 `struct:"uint32:17"`
ReferenceStationId uint16 `struct:"uint16:12"`
NRefs uint8 `struct:"uint8:7"`
Satellites uint8 `struct:"uint8:5,sizeof=SatelliteData"`
SatelliteData []struct {
SatelliteId uint8 `struct:"uint8:6"`
Soc uint8 `struct:"uint8"`
Sod uint16 `struct:"uint16:9"`
Soh uint8 `struct:"uint8:6"`
SIc uint16 `struct:"uint16:10"`
SId uint16 `struct:"uint16:10"`
}
}
func DeserializeMessage1031(data []byte) (msg Message1031) {
restruct.Unpack(data, binary.BigEndian, &msg)
return msg
}
func (msg Message1031) Serialize() []byte {
data, _ := restruct.Pack(binary.BigEndian, &msg)
return data
}
// Physical Reference Station Position Message
type Message1032 struct {
AbstractMessage
NonPhysicalReferenceStationId uint16 `struct:"uint16:12"`
PhysicalReferenceStationId uint16 `struct:"uint16:12"`
EpochYear uint8 `struct:"uint8:6"`
ArpEcefX int64 `struct:"int64:38"`
ArpEcefY int64 `struct:"int64:38"`
ArpEcefZ int64 `struct:"int64:38"`
}
func DeserializeMessage1032(data []byte) (msg Message1032) {
restruct.Unpack(data, binary.BigEndian, &msg)
return msg
}
func (msg Message1032) Serialize() []byte {
data, _ := restruct.Pack(binary.BigEndian, &msg)
return data
}