@@ -11,20 +11,19 @@ use std::str::Utf8Error;
11
11
12
12
/// GNSS satellite constellations
13
13
#[ derive( Debug , Copy , Clone , Ord , PartialOrd , Eq , PartialEq ) ]
14
- #[ repr( i32 ) ]
15
14
pub enum Constellation {
16
15
/// GPS
17
- Gps = c_bindings :: constellation_e_CONSTELLATION_GPS ,
16
+ Gps ,
18
17
/// SBAS - Space based augmentation systems
19
- Sbas = c_bindings :: constellation_e_CONSTELLATION_SBAS ,
18
+ Sbas ,
20
19
/// GLONASS
21
- Glo = c_bindings :: constellation_e_CONSTELLATION_GLO ,
20
+ Glo ,
22
21
/// Beidou
23
- Bds = c_bindings :: constellation_e_CONSTELLATION_BDS ,
22
+ Bds ,
24
23
/// QZSS
25
- Qzs = c_bindings :: constellation_e_CONSTELLATION_QZS ,
24
+ Qzs ,
26
25
/// Galileo
27
- Gal = c_bindings :: constellation_e_CONSTELLATION_GAL ,
26
+ Gal ,
28
27
}
29
28
30
29
impl Constellation {
@@ -43,7 +42,14 @@ impl Constellation {
43
42
}
44
43
45
44
pub ( crate ) fn to_constellation_t ( & self ) -> c_bindings:: constellation_t {
46
- * self as c_bindings:: constellation_t
45
+ match * self {
46
+ Constellation :: Gps => c_bindings:: constellation_e_CONSTELLATION_GPS,
47
+ Constellation :: Sbas => c_bindings:: constellation_e_CONSTELLATION_SBAS,
48
+ Constellation :: Glo => c_bindings:: constellation_e_CONSTELLATION_GLO,
49
+ Constellation :: Bds => c_bindings:: constellation_e_CONSTELLATION_BDS,
50
+ Constellation :: Qzs => c_bindings:: constellation_e_CONSTELLATION_QZS,
51
+ Constellation :: Gal => c_bindings:: constellation_e_CONSTELLATION_GAL,
52
+ }
47
53
}
48
54
49
55
/// Gets the specified maximum number of active satellites for the constellation
@@ -63,104 +69,103 @@ impl Constellation {
63
69
64
70
/// Code identifiers
65
71
#[ derive( Debug , Copy , Clone , Ord , PartialOrd , Eq , PartialEq ) ]
66
- #[ repr( i32 ) ]
67
72
pub enum Code {
68
73
/// GPS L1CA: BPSK(1)
69
- GpsL1ca = c_bindings :: code_e_CODE_GPS_L1CA ,
74
+ GpsL1ca ,
70
75
/// GPS L2C: 2 x BPSK(0.5)
71
- GpsL2cm = c_bindings :: code_e_CODE_GPS_L2CM ,
76
+ GpsL2cm ,
72
77
/// SBAS L1: BPSK(1)
73
- SbasL1ca = c_bindings :: code_e_CODE_SBAS_L1CA ,
78
+ SbasL1ca ,
74
79
/// GLONASS L1OF: FDMA BPSK(0.5)
75
- GloL1of = c_bindings :: code_e_CODE_GLO_L1OF ,
80
+ GloL1of ,
76
81
/// GLONASS L2OF: FDMA BPSK(0.5)
77
- GloL2of = c_bindings :: code_e_CODE_GLO_L2OF ,
82
+ GloL2of ,
78
83
/// GPS L1P(Y): encrypted BPSK(10)
79
- GpsL1p = c_bindings :: code_e_CODE_GPS_L1P ,
84
+ GpsL1p ,
80
85
/// GPS L2P(Y): encrypted BPSK(10)
81
- GpsL2p = c_bindings :: code_e_CODE_GPS_L2P ,
82
- GpsL2cl = c_bindings :: code_e_CODE_GPS_L2CL ,
83
- GpsL2cx = c_bindings :: code_e_CODE_GPS_L2CX ,
86
+ GpsL2p ,
87
+ GpsL2cl ,
88
+ GpsL2cx ,
84
89
/// GPS L5: QPSK(10) at 1150*f0
85
- GpsL5i = c_bindings :: code_e_CODE_GPS_L5I ,
86
- GpsL5q = c_bindings :: code_e_CODE_GPS_L5Q ,
87
- GpsL5x = c_bindings :: code_e_CODE_GPS_L5X ,
90
+ GpsL5i ,
91
+ GpsL5q ,
92
+ GpsL5x ,
88
93
/// BDS2 B1I: BPSK(2) at 1526*f0
89
- Bds2B1 = c_bindings :: code_e_CODE_BDS2_B1 ,
94
+ Bds2B1 ,
90
95
/// BDS2 B2I: BPSK(2) at 1180*f0
91
- Bds2B2 = c_bindings :: code_e_CODE_BDS2_B2 ,
96
+ Bds2B2 ,
92
97
/// Galileo E1: CASM CBOC(1,1) at 1540*f0
93
- GalE1b = c_bindings :: code_e_CODE_GAL_E1B ,
94
- GalE1c = c_bindings :: code_e_CODE_GAL_E1C ,
95
- GalE1x = c_bindings :: code_e_CODE_GAL_E1X ,
98
+ GalE1b ,
99
+ GalE1c ,
100
+ GalE1x ,
96
101
/// Galileo E6: CASM BPSK(5) at 1250*f0
97
- GalE6b = c_bindings :: code_e_CODE_GAL_E6B ,
98
- GalE6c = c_bindings :: code_e_CODE_GAL_E6C ,
99
- GalE6x = c_bindings :: code_e_CODE_GAL_E6X ,
102
+ GalE6b ,
103
+ GalE6c ,
104
+ GalE6x ,
100
105
/// Galileo E5b: QPSK(10) at 1180*f0
101
- GalE7i = c_bindings :: code_e_CODE_GAL_E7I ,
102
- GalE7q = c_bindings :: code_e_CODE_GAL_E7Q ,
103
- GalE7x = c_bindings :: code_e_CODE_GAL_E7X ,
106
+ GalE7i ,
107
+ GalE7q ,
108
+ GalE7x ,
104
109
/// Galileo E5AltBOC(15,10) at 1165*f0
105
- GalE8i = c_bindings :: code_e_CODE_GAL_E8I ,
106
- GalE8q = c_bindings :: code_e_CODE_GAL_E8Q ,
107
- GalE8x = c_bindings :: code_e_CODE_GAL_E8X ,
110
+ GalE8i ,
111
+ GalE8q ,
112
+ GalE8x ,
108
113
/// Galileo E5a: QPSK(10) at 1150*f0
109
- GalE5i = c_bindings :: code_e_CODE_GAL_E5I ,
110
- GalE5q = c_bindings :: code_e_CODE_GAL_E5Q ,
111
- GalE5x = c_bindings :: code_e_CODE_GAL_E5X ,
114
+ GalE5i ,
115
+ GalE5q ,
116
+ GalE5x ,
112
117
/// GLONASS L1P: encrypted
113
- GloL1p = c_bindings :: code_e_CODE_GLO_L1P ,
118
+ GloL1p ,
114
119
/// GLONASS L2P: encrypted
115
- GloL2p = c_bindings :: code_e_CODE_GLO_L2P ,
120
+ GloL2p ,
116
121
/// QZSS L1CA: BPSK(1) at 1540*f0
117
- QzsL1ca = c_bindings :: code_e_CODE_QZS_L1CA ,
122
+ QzsL1ca ,
118
123
/// QZSS L1C: TM-BOC at 1540*f0
119
- QzsL1ci = c_bindings :: code_e_CODE_QZS_L1CI ,
120
- QzsL1cq = c_bindings :: code_e_CODE_QZS_L1CQ ,
121
- QzsL1cx = c_bindings :: code_e_CODE_QZS_L1CX ,
124
+ QzsL1ci ,
125
+ QzsL1cq ,
126
+ QzsL1cx ,
122
127
/// QZSS L2C: 2 x BPSK(0.5) at 1200*f0
123
- QzsL2cm = c_bindings :: code_e_CODE_QZS_L2CM ,
124
- QzsL2cl = c_bindings :: code_e_CODE_QZS_L2CL ,
125
- QzsL2cx = c_bindings :: code_e_CODE_QZS_L2CX ,
128
+ QzsL2cm ,
129
+ QzsL2cl ,
130
+ QzsL2cx ,
126
131
/// QZSS L5: QPSK(10) at 1150*f0
127
- QzsL5i = c_bindings :: code_e_CODE_QZS_L5I ,
128
- QzsL5q = c_bindings :: code_e_CODE_QZS_L5Q ,
129
- QzsL5x = c_bindings :: code_e_CODE_QZS_L5X ,
132
+ QzsL5i ,
133
+ QzsL5q ,
134
+ QzsL5x ,
130
135
/// SBAS L5: ? at 1150*f0
131
- SbasL5i = c_bindings :: code_e_CODE_SBAS_L5I ,
132
- SbasL5q = c_bindings :: code_e_CODE_SBAS_L5Q ,
133
- SbasL5x = c_bindings :: code_e_CODE_SBAS_L5X ,
136
+ SbasL5i ,
137
+ SbasL5q ,
138
+ SbasL5x ,
134
139
/// BDS3 B1C: TM-BOC at 1540*f0
135
- Bds3B1ci = c_bindings :: code_e_CODE_BDS3_B1CI ,
136
- Bds3B1cq = c_bindings :: code_e_CODE_BDS3_B1CQ ,
137
- Bds3B1cx = c_bindings :: code_e_CODE_BDS3_B1CX ,
140
+ Bds3B1ci ,
141
+ Bds3B1cq ,
142
+ Bds3B1cx ,
138
143
/// BDS3 B2a: QPSK(10) at 1150*f0
139
- Bds3B5i = c_bindings :: code_e_CODE_BDS3_B5I ,
140
- Bds3B5q = c_bindings :: code_e_CODE_BDS3_B5Q ,
141
- Bds3B5x = c_bindings :: code_e_CODE_BDS3_B5X ,
144
+ Bds3B5i ,
145
+ Bds3B5q ,
146
+ Bds3B5x ,
142
147
/// BDS3 B2b: QPSK(10) at 1180*f0
143
- Bds3B7i = c_bindings :: code_e_CODE_BDS3_B7I ,
144
- Bds3B7q = c_bindings :: code_e_CODE_BDS3_B7Q ,
145
- Bds3B7x = c_bindings :: code_e_CODE_BDS3_B7X ,
148
+ Bds3B7i ,
149
+ Bds3B7q ,
150
+ Bds3B7x ,
146
151
/// BDS3 B3I: QPSK(10) at 1240*f0
147
- Bds3B3i = c_bindings :: code_e_CODE_BDS3_B3I ,
148
- Bds3B3q = c_bindings :: code_e_CODE_BDS3_B3Q ,
149
- Bds3B3x = c_bindings :: code_e_CODE_BDS3_B3X ,
152
+ Bds3B3i ,
153
+ Bds3B3q ,
154
+ Bds3B3x ,
150
155
/// GPS L1C: TM-BOC at 1540*f0
151
- GpsL1ci = c_bindings :: code_e_CODE_GPS_L1CI ,
152
- GpsL1cq = c_bindings :: code_e_CODE_GPS_L1CQ ,
153
- GpsL1cx = c_bindings :: code_e_CODE_GPS_L1CX ,
156
+ GpsL1ci ,
157
+ GpsL1cq ,
158
+ GpsL1cx ,
154
159
/// Auxiliary GPS antenna signals
155
- AuxGps = c_bindings :: code_e_CODE_AUX_GPS ,
160
+ AuxGps ,
156
161
/// Auxiliary SBAS antenna signals
157
- AuxSbas = c_bindings :: code_e_CODE_AUX_SBAS ,
162
+ AuxSbas ,
158
163
/// Auxiliary GAL antenna signals
159
- AuxGal = c_bindings :: code_e_CODE_AUX_GAL ,
164
+ AuxGal ,
160
165
/// Auxiliary QZSS antenna signals
161
- AuxQzs = c_bindings :: code_e_CODE_AUX_QZS ,
166
+ AuxQzs ,
162
167
/// Auxiliary BDS antenna signals
163
- AuxBds = c_bindings :: code_e_CODE_AUX_BDS ,
168
+ AuxBds ,
164
169
}
165
170
166
171
impl Code {
@@ -234,6 +239,75 @@ impl Code {
234
239
}
235
240
}
236
241
242
+ pub ( crate ) fn to_code_t ( & self ) -> c_bindings:: code_t {
243
+ match * self {
244
+ Code :: GpsL1ca => c_bindings:: code_e_CODE_GPS_L1CA,
245
+ Code :: GpsL2cm => c_bindings:: code_e_CODE_GPS_L2CM,
246
+ Code :: SbasL1ca => c_bindings:: code_e_CODE_SBAS_L1CA,
247
+ Code :: GloL1of => c_bindings:: code_e_CODE_GLO_L1OF,
248
+ Code :: GloL2of => c_bindings:: code_e_CODE_GLO_L2OF,
249
+ Code :: GpsL1p => c_bindings:: code_e_CODE_GPS_L1P,
250
+ Code :: GpsL2p => c_bindings:: code_e_CODE_GPS_L2P,
251
+ Code :: GpsL2cl => c_bindings:: code_e_CODE_GPS_L2CL,
252
+ Code :: GpsL2cx => c_bindings:: code_e_CODE_GPS_L2CX,
253
+ Code :: GpsL5i => c_bindings:: code_e_CODE_GPS_L5I,
254
+ Code :: GpsL5q => c_bindings:: code_e_CODE_GPS_L5Q,
255
+ Code :: GpsL5x => c_bindings:: code_e_CODE_GPS_L5X,
256
+ Code :: Bds2B1 => c_bindings:: code_e_CODE_BDS2_B1,
257
+ Code :: Bds2B2 => c_bindings:: code_e_CODE_BDS2_B2,
258
+ Code :: GalE1b => c_bindings:: code_e_CODE_GAL_E1B,
259
+ Code :: GalE1c => c_bindings:: code_e_CODE_GAL_E1C,
260
+ Code :: GalE1x => c_bindings:: code_e_CODE_GAL_E1X,
261
+ Code :: GalE6b => c_bindings:: code_e_CODE_GAL_E6B,
262
+ Code :: GalE6c => c_bindings:: code_e_CODE_GAL_E6C,
263
+ Code :: GalE6x => c_bindings:: code_e_CODE_GAL_E6X,
264
+ Code :: GalE7i => c_bindings:: code_e_CODE_GAL_E7I,
265
+ Code :: GalE7q => c_bindings:: code_e_CODE_GAL_E7Q,
266
+ Code :: GalE7x => c_bindings:: code_e_CODE_GAL_E7X,
267
+ Code :: GalE8i => c_bindings:: code_e_CODE_GAL_E8I,
268
+ Code :: GalE8q => c_bindings:: code_e_CODE_GAL_E8Q,
269
+ Code :: GalE8x => c_bindings:: code_e_CODE_GAL_E8X,
270
+ Code :: GalE5i => c_bindings:: code_e_CODE_GAL_E5I,
271
+ Code :: GalE5q => c_bindings:: code_e_CODE_GAL_E5Q,
272
+ Code :: GalE5x => c_bindings:: code_e_CODE_GAL_E5X,
273
+ Code :: GloL1p => c_bindings:: code_e_CODE_GLO_L1P,
274
+ Code :: GloL2p => c_bindings:: code_e_CODE_GLO_L2P,
275
+ Code :: QzsL1ca => c_bindings:: code_e_CODE_QZS_L1CA,
276
+ Code :: QzsL1ci => c_bindings:: code_e_CODE_QZS_L1CI,
277
+ Code :: QzsL1cq => c_bindings:: code_e_CODE_QZS_L1CQ,
278
+ Code :: QzsL1cx => c_bindings:: code_e_CODE_QZS_L1CX,
279
+ Code :: QzsL2cm => c_bindings:: code_e_CODE_QZS_L2CM,
280
+ Code :: QzsL2cl => c_bindings:: code_e_CODE_QZS_L2CL,
281
+ Code :: QzsL2cx => c_bindings:: code_e_CODE_QZS_L2CX,
282
+ Code :: QzsL5i => c_bindings:: code_e_CODE_QZS_L5I,
283
+ Code :: QzsL5q => c_bindings:: code_e_CODE_QZS_L5Q,
284
+ Code :: QzsL5x => c_bindings:: code_e_CODE_QZS_L5X,
285
+ Code :: SbasL5i => c_bindings:: code_e_CODE_SBAS_L5I,
286
+ Code :: SbasL5q => c_bindings:: code_e_CODE_SBAS_L5Q,
287
+ Code :: SbasL5x => c_bindings:: code_e_CODE_SBAS_L5X,
288
+ Code :: Bds3B1ci => c_bindings:: code_e_CODE_BDS3_B1CI,
289
+ Code :: Bds3B1cq => c_bindings:: code_e_CODE_BDS3_B1CQ,
290
+ Code :: Bds3B1cx => c_bindings:: code_e_CODE_BDS3_B1CX,
291
+ Code :: Bds3B5i => c_bindings:: code_e_CODE_BDS3_B5I,
292
+ Code :: Bds3B5q => c_bindings:: code_e_CODE_BDS3_B5Q,
293
+ Code :: Bds3B5x => c_bindings:: code_e_CODE_BDS3_B5X,
294
+ Code :: Bds3B7i => c_bindings:: code_e_CODE_BDS3_B7I,
295
+ Code :: Bds3B7q => c_bindings:: code_e_CODE_BDS3_B7Q,
296
+ Code :: Bds3B7x => c_bindings:: code_e_CODE_BDS3_B7X,
297
+ Code :: Bds3B3i => c_bindings:: code_e_CODE_BDS3_B3I,
298
+ Code :: Bds3B3q => c_bindings:: code_e_CODE_BDS3_B3Q,
299
+ Code :: Bds3B3x => c_bindings:: code_e_CODE_BDS3_B3X,
300
+ Code :: GpsL1ci => c_bindings:: code_e_CODE_GPS_L1CI,
301
+ Code :: GpsL1cq => c_bindings:: code_e_CODE_GPS_L1CQ,
302
+ Code :: GpsL1cx => c_bindings:: code_e_CODE_GPS_L1CX,
303
+ Code :: AuxGps => c_bindings:: code_e_CODE_AUX_GPS,
304
+ Code :: AuxSbas => c_bindings:: code_e_CODE_AUX_SBAS,
305
+ Code :: AuxGal => c_bindings:: code_e_CODE_AUX_GAL,
306
+ Code :: AuxQzs => c_bindings:: code_e_CODE_AUX_QZS,
307
+ Code :: AuxBds => c_bindings:: code_e_CODE_AUX_BDS,
308
+ }
309
+ }
310
+
237
311
/// Attempts to make a `Code` from a string
238
312
pub fn from_str ( s : & ffi:: CStr ) -> Option < Code > {
239
313
Self :: from_code_t ( unsafe { c_bindings:: code_string_to_enum ( s. as_ptr ( ) ) } )
@@ -252,10 +326,6 @@ impl Code {
252
326
. unwrap ( )
253
327
}
254
328
255
- pub ( crate ) fn to_code_t ( & self ) -> c_bindings:: code_t {
256
- * self as c_bindings:: code_t
257
- }
258
-
259
329
/// Get the number of signals for a code
260
330
pub fn sig_count ( & self ) -> u16 {
261
331
unsafe { c_bindings:: code_to_sig_count ( self . to_code_t ( ) ) }
0 commit comments