0.4.1
Loading...
Searching...
No Matches
Frequency.hpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9/// @file Frequency.hpp
10/// @brief Frequency definition for different satellite systems
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2022-04-26
13
14#pragma once
15
16#include <string>
17#include <fmt/format.h>
18
20
21namespace NAV
22{
23
24/// Enumerate for GNSS frequencies
25enum Frequency_ : uint64_t
26{ // clang-format off
27 Freq_None = 0x0000'0000'0000'0000, ///< None
28 G01 = 0x0000'0000'0000'0001, ///< GPS L1 (1575.42 MHz).
29 G02 = 0x0000'0000'0000'0002, ///< GPS L2 (1227.6 MHz).
30 G05 = 0x0000'0000'0000'0004, ///< GPS L5 (1176.45 MHz).
31 E01 = 0x0000'0000'0000'0100, ///< Galileo, "E1" (1575.42 MHz).
32 E05 = 0x0000'0000'0000'0200, ///< Galileo E5a (1176.45 MHz).
33 E06 = 0x0000'0000'0000'0400, ///< Galileo E6 (1278.75 MHz).
34 E07 = 0x0000'0000'0000'0800, ///< Galileo E5b (1207.14 MHz).
35 E08 = 0x0000'0000'0000'1000, ///< Galileo E5 (E5a + E5b) (1191.795MHz).
36 R01 = 0x0000'0000'0001'0000, ///< GLONASS, "G1" (1602 MHZ).
37 R02 = 0x0000'0000'0002'0000, ///< GLONASS, "G2" (1246 MHz).
38 R03 = 0x0000'0000'0004'0000, ///< GLONASS, "G3" (1202.025 MHz).
39 R04 = 0x0000'0000'0008'0000, ///< GLONASS, "G1a" (1600.995 MHZ).
40 R06 = 0x0000'0000'0010'0000, ///< GLONASS, "G2a" (1248.06 MHz).
41 B01 = 0x0000'0000'0100'0000, ///< Beidou B1 (1575.42 MHz).
42 B02 = 0x0000'0000'0200'0000, ///< Beidou B1-2 (B1I) (1561.098 MHz).
43 B05 = 0x0000'0000'0400'0000, ///< Beidou B2a (1176.45 MHz).
44 B06 = 0x0000'0000'0800'0000, ///< Beidou B3 (1268.52 MHz).
45 B07 = 0x0000'0000'1000'0000, ///< Beidou B2b (B2I) (1207.14 MHz).
46 B08 = 0x0000'0000'2000'0000, ///< Beidou B2 (B2a + B2b) (1191.795MHz).
47 J01 = 0x0000'0001'0000'0000, ///< QZSS L1 (1575.42 MHz).
48 J02 = 0x0000'0002'0000'0000, ///< QZSS L2 (1227.6 MHz).
49 J05 = 0x0000'0004'0000'0000, ///< QZSS L5 (1176.45 MHz).
50 J06 = 0x0000'0008'0000'0000, ///< QZSS L6 / LEX (1278.75 MHz).
51 I05 = 0x0000'0100'0000'0000, ///< IRNSS L5 (1176.45 MHz).
52 I09 = 0x0000'0200'0000'0000, ///< IRNSS S (2492.028 MHz).
53 S01 = 0x0001'0000'0000'0000, ///< SBAS L1 (1575.42 MHz).
54 S05 = 0x0002'0000'0000'0000, ///< SBAS L5 (1176.45 MHz).
55}; // clang-format on
56
57/// @brief Frequency definition for different satellite systems
59{
60 public:
61 /// @brief Satellite System enumeration with continuous range. Not usable as a mask
62 enum Enum : uint8_t
63 {
64 Enum_G01, ///< GPS L1 (1575.42 MHz).
65 Enum_G02, ///< GPS L2 (1227.6 MHz).
66 Enum_G05, ///< GPS L5 (1176.45 MHz).
67 Enum_E01, ///< Galileo, "E1" (1575.42 MHz).
68 Enum_E05, ///< Galileo E5a (1176.45 MHz).
69 Enum_E06, ///< Galileo E6 (1278.75 MHz).
70 Enum_E07, ///< Galileo E5b (1207.14 MHz).
71 Enum_E08, ///< Galileo E5 (E5a + E5b) (1191.795MHz).
72 Enum_R01, ///< GLONASS, "G1" (1602 MHZ).
73 Enum_R02, ///< GLONASS, "G2" (1246 MHz).
74 Enum_R03, ///< GLONASS, "G3" (1202.025 MHz).
75 Enum_R04, ///< GLONASS, "G1a" (1600.995 MHZ).
76 Enum_R06, ///< GLONASS, "G2a" (1248.06 MHz).
77 Enum_B01, ///< Beidou B1 (1575.42 MHz).
78 Enum_B02, ///< Beidou B1-2 (1561.098 MHz).
79 Enum_B05, ///< Beidou B2a (1176.45 MHz).
80 Enum_B06, ///< Beidou B3 (1268.52 MHz).
81 Enum_B07, ///< Beidou B2b (1207.14 MHz).
82 Enum_B08, ///< Beidou B2 (B2a + B2b) (1191.795MHz).
83 Enum_J01, ///< QZSS L1 (1575.42 MHz).
84 Enum_J02, ///< QZSS L2 (1227.6 MHz).
85 Enum_J05, ///< QZSS L5 (1176.45 MHz).
86 Enum_J06, ///< QZSS L6 / LEX (1278.75 MHz).
87 Enum_I05, ///< IRNSS L5 (1176.45 MHz).
88 Enum_I09, ///< IRNSS S (2492.028 MHz).
89 Enum_S01, ///< SBAS L1 (1575.42 MHz).
90 Enum_S05, ///< SBAS L5 (1176.45 MHz).
91 Enum_COUNT, ///< Count variable
92 Enum_None, ///< No Frequency
93 };
94
95 /// @brief Default Constructor
96 constexpr Frequency() = default;
97
98 /// @brief Implicit Constructor from Value type
99 /// @param[in] type Value type to construct from
100 constexpr Frequency(Frequency_ type) // NOLINT(hicpp-explicit-conversions, google-explicit-constructor)
101 : value(type)
102 {}
103
104 /// @brief Implicit Constructor from Enum type
105 /// @param[in] enumeration Enum type to construct from
106 Frequency(Enum enumeration) // NOLINT(hicpp-explicit-conversions, google-explicit-constructor)
107 : value(Frequency::fromEnum(enumeration))
108 {}
109
110 /// @brief Construct new object from std::string
111 /// @param[in] typeString String representation of the frequency
112 static Frequency fromString(const std::string& typeString);
113
114 /// @brief Constructs a new object from continuous enumeration
115 /// @param[in] enumeration Continuous enumeration of the frequency
116 static Frequency fromEnum(Enum enumeration);
117
118 /// @brief Assignment operator from Value type
119 /// @param[in] v Value type to construct from
120 /// @return The Type type from the value type
122 {
123 value = v;
124 return *this;
125 }
126
127 friend constexpr bool operator==(const Frequency& lhs, const Frequency& rhs);
128
129 /// @brief Less than comparison (needed for map)
130 /// @param[in] rhs Right hand side of the operator
131 /// @return True if lhs < rhs
132 constexpr bool operator<(const Frequency& rhs) const { return value < rhs.value; }
133
134 /// @brief Allow switch(Frequency_(type)) and comparisons
135 constexpr explicit operator Frequency_() const { return value; }
136 /// @brief Prevent usage: if(...)
137 constexpr explicit operator bool() = delete;
138
139 /// @brief int conversion operator
140 /// @return A int representation of the type
141 constexpr explicit operator uint64_t() const { return uint64_t(value); }
142
143 /// @brief std::string conversion operator
144 /// @return A std::string representation of the type
145 explicit operator std::string() const;
146
147 /// @brief Get the Time System of the specified Frequency
148 /// @param[in] freq Frequency to get the satellite system for
150
151 /// @brief Get the satellite system for which this frequency is defined
152 [[nodiscard]] SatelliteSystem getSatSys() const
153 {
155 }
156
157 /// @brief Get the frequency in [Hz]
158 /// @param[in] freq Frequency to get the value for
159 /// @param[in] num Frequency number. Only used for GLONASS G1 and G2
160 static double GetFrequency(Frequency freq, int8_t num);
161
162 /// @brief Get the frequency in [Hz]
163 /// @param[in] num Frequency number. Only used for GLONASS G1 and G2
164 [[nodiscard]] double getFrequency(int8_t num) const
165 {
166 return GetFrequency(value, num);
167 }
168
169 /// @brief Returns the L1 Frequency for each constellation
170 /// @param[in] freq Frequency to get the value for
171 static Frequency GetL1(Frequency freq);
172
173 /// @brief Returns the L1 Frequency for each constellation
174 [[nodiscard]] Frequency getL1() const
175 {
176 return GetL1(value);
177 }
178
179 /// Counts the amount of frequencies contained
180 [[nodiscard]] size_t count() const;
181
182 /// @brief Returns a list with all possible frequencies
183 constexpr static std::array<Frequency, 27> GetAll()
184 {
185 return { G01, G02, G05,
186 E01, E05, E06, E07, E08,
187 R01, R02, R03, R04, R06,
188 B01, B02, B05, B06, B07, B08,
189 J01, J02, J05, J06,
190 I05, I09,
191 S01, S05 };
192 }
193
194 /// @brief Get the continuous enumeration of the specified frequency
195 /// @param[in] freq Frequency to get the continuous enumeration for
196 static Enum ToEnumeration(Frequency freq);
197
198 /// @brief Returns a continuous enumeration of the object
199 [[nodiscard]] Enum toEnumeration() const;
200
201 /// @brief Get a vector representation of the specified Frequency
202 /// @param[in] freq Frequency to get the vector for
203 static std::vector<Frequency> ToVector(Frequency freq);
204
205 /// @brief Get a vector representation of the specified Frequency
206 [[nodiscard]] std::vector<Frequency> toVector() const;
207
208 /// @brief Checks wether the given frequency is the first in the filter (per system)
209 /// @param[in] freq Single Frequency
210 /// @param[in] filter Filter of multiple frequencies
211 static bool IsFirstFrequency(const Frequency& freq, const Frequency& filter);
212
213 /// @brief Checks wether the frequency is the first in the filter (per system)
214 /// @param[in] filter Filter of multiple frequencies
215 [[nodiscard]] bool isFirstFrequency(const Frequency& filter) const;
216
217 private:
218 /// @brief Internal value
220};
221
222// #########################################################################################################################################
223
224/// @brief Converts the provided link into a json object
225/// @param[out] j Json object which gets filled with the info
226/// @param[in] data Data to convert into json
227void to_json(json& j, const Frequency& data);
228/// @brief Converts the provided json object into a link object
229/// @param[in] j Json object with the needed values
230/// @param[out] data Object to fill from the json
231void from_json(const json& j, Frequency& data);
232
233// #########################################################################################################################################
234
235/// @brief Allows combining flags of the Frequency enum.
236/// @param[in] lhs Left-hand side enum value.
237/// @param[in] rhs Right-hand side enum value.
238/// @return The binary ORed value.
240{
241 return Frequency_(uint64_t(lhs) | uint64_t(rhs));
242}
243/// @brief Allows combining flags of the Frequency enum.
244/// @param[in] lhs Left-hand side enum value.
245/// @param[in] rhs Right-hand side enum value.
246/// @return The binary ORed value.
248{
249 return Frequency_(lhs) | Frequency_(rhs);
250}
251/// @brief Allows combining flags of the Frequency enum.
252/// @param[in] lhs Left-hand side enum value.
253/// @param[in] rhs Right-hand side enum value.
254/// @return The binary ORed value.
256{
257 return lhs | Frequency_(rhs);
258}
259/// @brief Allows combining flags of the Frequency enum.
260/// @param[in] lhs Left-hand side enum value.
261/// @param[in] rhs Right-hand side enum value.
262/// @return The binary ORed value.
264{
265 return Frequency_(lhs) | rhs;
266}
267
268/// @brief Allows combining flags of the Frequency enum.
269/// @param[in] lhs Left-hand side enum value.
270/// @param[in] rhs Right-hand side enum value.
271/// @return The binary ORed value.
272constexpr Frequency_& operator|=(Frequency_& lhs, const Frequency_& rhs)
273{
274 lhs = lhs | rhs;
275 return lhs;
276}
277/// @brief Allows combining flags of the Frequency enum.
278/// @param[in] lhs Left-hand side enum value.
279/// @param[in] rhs Right-hand side enum value.
280/// @return The binary ORed value.
281constexpr Frequency& operator|=(Frequency& lhs, const Frequency& rhs)
282{
283 lhs = lhs | rhs;
284 return lhs;
285}
286/// @brief Allows combining flags of the Frequency enum.
287/// @param[in] lhs Left-hand side enum value.
288/// @param[in] rhs Right-hand side enum value.
289/// @return The binary ORed value.
290constexpr Frequency_& operator|=(Frequency_& lhs, const Frequency& rhs)
291{
292 lhs = lhs | Frequency_(rhs);
293 return lhs;
294}
295/// @brief Allows combining flags of the Frequency enum.
296/// @param[in] lhs Left-hand side enum value.
297/// @param[in] rhs Right-hand side enum value.
298/// @return The binary ORed value.
299constexpr Frequency& operator|=(Frequency& lhs, const Frequency_& rhs)
300{
301 lhs = lhs | rhs;
302 return lhs;
303}
304
305/// @brief Allows combining flags of the Frequency enum.
306/// @param[in] lhs Left-hand side enum value.
307/// @param[in] rhs Right-hand side enum value.
308/// @return The binary ANDed value.
310{
311 return Frequency_(uint64_t(lhs) & uint64_t(rhs));
312}
313/// @brief Allows combining flags of the Frequency enum.
314/// @param[in] lhs Left-hand side enum value.
315/// @param[in] rhs Right-hand side enum value.
316/// @return The binary ANDed value.
318{
319 return Frequency_(lhs) & Frequency_(rhs);
320}
321/// @brief Allows combining flags of the Frequency enum.
322/// @param[in] lhs Left-hand side enum value.
323/// @param[in] rhs Right-hand side enum value.
324/// @return The binary ANDed value.
326{
327 return Frequency_(lhs) & rhs;
328}
329/// @brief Allows combining flags of the Frequency enum.
330/// @param[in] lhs Left-hand side enum value.
331/// @param[in] rhs Right-hand side enum value.
332/// @return The binary ANDed value.
334{
335 return lhs & Frequency_(rhs);
336}
337
338/// @brief Allows combining flags of the Frequency enum.
339/// @param[in] lhs Left-hand side enum value.
340/// @param[in] rhs Right-hand side enum value.
341/// @return The binary ANDed value.
342constexpr Frequency_& operator&=(Frequency_& lhs, const Frequency_& rhs)
343{
344 lhs = lhs & rhs;
345 return lhs;
346}
347/// @brief Allows combining flags of the Frequency enum.
348/// @param[in] lhs Left-hand side enum value.
349/// @param[in] rhs Right-hand side enum value.
350/// @return The binary ANDed value.
351constexpr Frequency& operator&=(Frequency& lhs, const Frequency& rhs)
352{
353 lhs = lhs & rhs;
354 return lhs;
355}
356/// @brief Allows combining flags of the Frequency enum.
357/// @param[in] lhs Left-hand side enum value.
358/// @param[in] rhs Right-hand side enum value.
359/// @return The binary ANDed value.
360constexpr Frequency_& operator&=(Frequency_& lhs, const Frequency& rhs)
361{
362 lhs = lhs & Frequency_(rhs);
363 return lhs;
364}
365/// @brief Allows combining flags of the Frequency enum.
366/// @param[in] lhs Left-hand side enum value.
367/// @param[in] rhs Right-hand side enum value.
368/// @return The binary ANDed value.
369constexpr Frequency& operator&=(Frequency& lhs, const Frequency_& rhs)
370{
371 lhs = lhs & rhs;
372 return lhs;
373}
374
375/// @brief Allows negating flags of the Frequency enum.
376/// @param[in] rhs Right-hand side enum value.
377/// @return The binary NEGed value.
379{
380 return Frequency_(~uint64_t(rhs));
381}
382/// @brief Allows negating flags of the Frequency enum.
383/// @param[in] rhs Right-hand side enum value.
384/// @return The binary NEGed value.
386{
387 return Frequency_(~uint64_t(rhs));
388}
389
390/// @brief Equal compares values
391/// @param[in] lhs Left-hand side of the operator
392/// @param[in] rhs Right-hand side of the operator
393/// @return Whether the comparison was successful
394constexpr bool operator==(const Frequency& lhs, const Frequency& rhs) { return lhs.value == rhs.value; }
395/// @brief Equal compares values
396/// @param[in] lhs Left-hand side of the operator
397/// @param[in] rhs Right-hand side of the operator
398/// @return Whether the comparison was successful
399constexpr bool operator==(const Frequency& lhs, const Frequency_& rhs) { return lhs == Frequency(rhs); }
400/// @brief Equal compares values
401/// @param[in] lhs Left-hand side of the operator
402/// @param[in] rhs Right-hand side of the operator
403/// @return Whether the comparison was successful
404constexpr bool operator==(const Frequency_& lhs, const Frequency& rhs) { return Frequency(lhs) == rhs; }
405
406/// @brief Inequal compares values
407/// @param[in] lhs Left-hand side of the operator
408/// @param[in] rhs Right-hand side of the operator
409/// @return Whether the comparison was successful
410constexpr bool operator!=(const Frequency& lhs, const Frequency& rhs) { return !(lhs == rhs); }
411/// @brief Inequal compares values
412/// @param[in] lhs Left-hand side of the operator
413/// @param[in] rhs Right-hand side of the operator
414/// @return Whether the comparison was successful
415constexpr bool operator!=(const Frequency& lhs, const Frequency_& rhs) { return !(lhs == rhs); }
416/// @brief Inequal compares values
417/// @param[in] lhs Left-hand side of the operator
418/// @param[in] rhs Right-hand side of the operator
419/// @return Whether the comparison was successful
420constexpr bool operator!=(const Frequency_& lhs, const Frequency& rhs) { return !(lhs == rhs); }
421
422// #########################################################################################################################################
423
424/// @brief Allows filtering Frequency with SatelliteSystem.
425/// @param[in] lhs Left-hand side enum value.
426/// @param[in] rhs Right-hand side enum value.
427/// @return The binary ANDed value.
429{
430 return Frequency_(uint64_t(lhs) & uint64_t(rhs));
431}
432/// @brief Allows filtering Frequency with SatelliteSystem.
433/// @param[in] lhs Left-hand side enum value.
434/// @param[in] rhs Right-hand side enum value.
435/// @return The binary ANDed value.
437{
438 return Frequency_(uint64_t(lhs) & uint64_t(rhs));
439}
440/// @brief Allows filtering Frequency with SatelliteSystem.
441/// @param[in] lhs Left-hand side enum value.
442/// @param[in] rhs Right-hand side enum value.
443/// @return The binary ANDed value.
445{
446 lhs = lhs & rhs;
447 return lhs;
448}
449
450/// @brief Allows filtering Frequency with SatelliteSystem.
451/// @param[in] lhs Left-hand side enum value.
452/// @param[in] rhs Right-hand side enum value.
453/// @return The binary ANDed value.
455{
456 return Frequency_(uint64_t(lhs) & uint64_t(rhs));
457}
458/// @brief Allows filtering Frequency with SatelliteSystem.
459/// @param[in] lhs Left-hand side enum value.
460/// @param[in] rhs Right-hand side enum value.
461/// @return The binary ANDed value.
463{
464 return Frequency_(uint64_t(lhs) & uint64_t(rhs));
465}
466/// @brief Allows filtering Frequency with SatelliteSystem.
467/// @param[in] lhs Left-hand side enum value.
468/// @param[in] rhs Right-hand side enum value.
469/// @return The binary ANDed value.
471{
472 lhs = lhs & rhs;
473 return lhs;
474}
475
476/// @brief Allows filtering Frequency with SatelliteSystem.
477/// @param[in] lhs Left-hand side enum value.
478/// @param[in] rhs Right-hand side enum value.
479/// @return The binary ANDed value.
481{
482 return Frequency_(uint64_t(lhs) & uint64_t(rhs));
483}
484/// @brief Allows filtering Frequency with SatelliteSystem.
485/// @param[in] lhs Left-hand side enum value.
486/// @param[in] rhs Right-hand side enum value.
487/// @return The binary ANDed value.
489{
490 return Frequency_(uint64_t(lhs) & uint64_t(rhs));
491}
492/// @brief Allows filtering Frequency with SatelliteSystem.
493/// @param[in] lhs Left-hand side enum value.
494/// @param[in] rhs Right-hand side enum value.
495/// @return The binary ANDed value.
496constexpr Frequency& operator&=(Frequency& lhs, const SatelliteSystem_& rhs)
497{
498 lhs = lhs & rhs;
499 return lhs;
500}
501
502/// @brief Allows filtering Frequency with SatelliteSystem.
503/// @param[in] lhs Left-hand side enum value.
504/// @param[in] rhs Right-hand side enum value.
505/// @return The binary ANDed value.
507{
508 return Frequency_(uint64_t(lhs) & uint64_t(rhs));
509}
510/// @brief Allows filtering Frequency with SatelliteSystem.
511/// @param[in] lhs Left-hand side enum value.
512/// @param[in] rhs Right-hand side enum value.
513/// @return The binary ANDed value.
515{
516 return Frequency_(uint64_t(lhs) & uint64_t(rhs));
517}
518/// @brief Allows filtering Frequency with SatelliteSystem.
519/// @param[in] lhs Left-hand side enum value.
520/// @param[in] rhs Right-hand side enum value.
521/// @return The binary ANDed value.
522constexpr Frequency& operator&=(Frequency& lhs, const SatelliteSystem& rhs)
523{
524 lhs = lhs & rhs;
525 return lhs;
526}
527
528/// All Frequencies
530 | E01 | E05 | E06 | E07 | E08
531 | R01 | R02 | R03 | R04 | R06
532 | B01 | B02 | B05 | B06 | B07 | B08
533 | J01 | J02 | J05 | J06
534 | I05 | I09
535 | S01 | S05;
536
537/// @brief Shows a ComboBox to select GNSS frequencies
538/// @param[in] label Label to show beside the combo box. This has to be a unique id for ImGui.
539/// @param[in, out] frequency Reference to the frequency object to select
540/// @param[in] singleSelect If true, only one code can be selected at a time
541bool ShowFrequencySelector(const char* label, Frequency& frequency, bool singleSelect = false);
542
543} // namespace NAV
544
545/// @brief Stream insertion operator overload
546/// @param[in, out] os Output stream object to stream the time into
547/// @param[in] obj Object to print
548/// @return Returns the output stream object in order to chain stream insertions
549std::ostream& operator<<(std::ostream& os, const NAV::Frequency& obj);
550
551namespace std
552{
553/// @brief Hash function for Frequency (needed for unordered_map)
554template<>
555struct hash<NAV::Frequency_>
556{
557 /// @brief Hash function for Frequency
558 /// @param[in] f Satellite frequency
559 /// @return Has value for the frequency
560 std::size_t operator()(const NAV::Frequency_& f) const
561 {
562 using namespace NAV; // NOLINT(google-build-using-namespace)
563 switch (f)
564 {
565 case Freq_None:
566 return 2;
567 case G01:
568 return 101;
569 case G02:
570 return 102;
571 case G05:
572 return 103;
573 case E01:
574 return 201;
575 case E05:
576 return 202;
577 case E06:
578 return 203;
579 case E07:
580 return 204;
581 case E08:
582 return 205;
583 case R01:
584 return 301;
585 case R02:
586 return 302;
587 case R03:
588 return 303;
589 case R04:
590 return 304;
591 case R06:
592 return 305;
593 case B01:
594 return 401;
595 case B02:
596 return 402;
597 case B05:
598 return 403;
599 case B06:
600 return 404;
601 case B07:
602 return 405;
603 case B08:
604 return 406;
605 case J01:
606 return 501;
607 case J02:
608 return 502;
609 case J05:
610 return 503;
611 case J06:
612 return 504;
613 case I05:
614 return 601;
615 case I09:
616 return 602;
617 case S01:
618 return 701;
619 case S05:
620 return 702;
621 }
622
623 return 0;
624 }
625};
626/// @brief Hash function for Frequency (needed for unordered_map)
627template<>
628struct hash<NAV::Frequency>
629{
630 /// @brief Hash function for Frequency
631 /// @param[in] f Satellite frequency
632 /// @return Has value for the frequency
633 std::size_t operator()(const NAV::Frequency& f) const
634 {
635 return std::hash<NAV::Frequency_>()(NAV::Frequency_(f));
636 }
637};
638} // namespace std
639
640#ifndef DOXYGEN_IGNORE
641
642/// @brief Formatter for Frequency
643template<>
644struct fmt::formatter<NAV::Frequency> : fmt::formatter<std::string>
645{
646 /// @brief Defines how to format Frequency structs
647 /// @param[in] freq Struct to format
648 /// @param[in, out] ctx Format context
649 /// @return Output iterator
650 template<typename FormatContext>
651 auto format(const NAV::Frequency& freq, FormatContext& ctx) const
652 {
653 return fmt::formatter<std::string>::format(std::string(freq), ctx);
654 }
655};
656
657#endif
nlohmann::json json
json namespace
std::ostream & operator<<(std::ostream &os, const NAV::Frequency &obj)
Stream insertion operator overload.
GNSS Satellite System.
Frequency definition for different satellite systems.
Definition Frequency.hpp:59
constexpr Frequency & operator=(Frequency_ v)
Assignment operator from Value type.
static constexpr std::array< Frequency, 27 > GetAll()
Returns a list with all possible frequencies.
SatelliteSystem getSatSys() const
Get the satellite system for which this frequency is defined.
constexpr Frequency(Frequency_ type)
Implicit Constructor from Value type.
Frequency getL1() const
Returns the L1 Frequency for each constellation.
Frequency(Enum enumeration)
Implicit Constructor from Enum type.
std::vector< Frequency > toVector() const
Get a vector representation of the specified Frequency.
static double GetFrequency(Frequency freq, int8_t num)
Get the frequency in [Hz].
static Enum ToEnumeration(Frequency freq)
Get the continuous enumeration of the specified frequency.
static Frequency fromEnum(Enum enumeration)
Constructs a new object from continuous enumeration.
Definition Frequency.cpp:55
Enum
Satellite System enumeration with continuous range. Not usable as a mask.
Definition Frequency.hpp:63
@ Enum_R02
GLONASS, "G2" (1246 MHz).
Definition Frequency.hpp:73
@ Enum_R03
GLONASS, "G3" (1202.025 MHz).
Definition Frequency.hpp:74
@ Enum_None
No Frequency.
Definition Frequency.hpp:92
@ Enum_B08
Beidou B2 (B2a + B2b) (1191.795MHz).
Definition Frequency.hpp:82
@ Enum_J05
QZSS L5 (1176.45 MHz).
Definition Frequency.hpp:85
@ Enum_COUNT
Count variable.
Definition Frequency.hpp:91
@ Enum_E08
Galileo E5 (E5a + E5b) (1191.795MHz).
Definition Frequency.hpp:71
@ Enum_E01
Galileo, "E1" (1575.42 MHz).
Definition Frequency.hpp:67
@ Enum_B05
Beidou B2a (1176.45 MHz).
Definition Frequency.hpp:79
@ Enum_B07
Beidou B2b (1207.14 MHz).
Definition Frequency.hpp:81
@ Enum_R06
GLONASS, "G2a" (1248.06 MHz).
Definition Frequency.hpp:76
@ Enum_R01
GLONASS, "G1" (1602 MHZ).
Definition Frequency.hpp:72
@ Enum_R04
GLONASS, "G1a" (1600.995 MHZ).
Definition Frequency.hpp:75
@ Enum_S01
SBAS L1 (1575.42 MHz).
Definition Frequency.hpp:89
@ Enum_G05
GPS L5 (1176.45 MHz).
Definition Frequency.hpp:66
@ Enum_E07
Galileo E5b (1207.14 MHz).
Definition Frequency.hpp:70
@ Enum_G02
GPS L2 (1227.6 MHz).
Definition Frequency.hpp:65
@ Enum_G01
GPS L1 (1575.42 MHz).
Definition Frequency.hpp:64
@ Enum_I05
IRNSS L5 (1176.45 MHz).
Definition Frequency.hpp:87
@ Enum_I09
IRNSS S (2492.028 MHz).
Definition Frequency.hpp:88
@ Enum_S05
SBAS L5 (1176.45 MHz).
Definition Frequency.hpp:90
@ Enum_B02
Beidou B1-2 (1561.098 MHz).
Definition Frequency.hpp:78
@ Enum_J02
QZSS L2 (1227.6 MHz).
Definition Frequency.hpp:84
@ Enum_J06
QZSS L6 / LEX (1278.75 MHz).
Definition Frequency.hpp:86
@ Enum_E05
Galileo E5a (1176.45 MHz).
Definition Frequency.hpp:68
@ Enum_E06
Galileo E6 (1278.75 MHz).
Definition Frequency.hpp:69
@ Enum_J01
QZSS L1 (1575.42 MHz).
Definition Frequency.hpp:83
@ Enum_B06
Beidou B3 (1268.52 MHz).
Definition Frequency.hpp:80
@ Enum_B01
Beidou B1 (1575.42 MHz).
Definition Frequency.hpp:77
static Frequency fromString(const std::string &typeString)
Construct new object from std::string.
Definition Frequency.cpp:22
static bool IsFirstFrequency(const Frequency &freq, const Frequency &filter)
Checks wether the given frequency is the first in the filter (per system)
Enum toEnumeration() const
Returns a continuous enumeration of the object.
friend constexpr bool operator==(const Frequency &lhs, const Frequency &rhs)
Equal compares values.
bool isFirstFrequency(const Frequency &filter) const
Checks wether the frequency is the first in the filter (per system)
constexpr Frequency()=default
Default Constructor.
Frequency_ value
Internal value.
static Frequency GetL1(Frequency freq)
Returns the L1 Frequency for each constellation.
static std::vector< Frequency > ToVector(Frequency freq)
Get a vector representation of the specified Frequency.
double getFrequency(int8_t num) const
Get the frequency in [Hz].
size_t count() const
Counts the amount of frequencies contained.
static SatelliteSystem GetSatelliteSystemForFrequency(Frequency freq)
Get the Time System of the specified Frequency.
constexpr bool operator<(const Frequency &rhs) const
Less than comparison (needed for map)
void to_json(json &j, const Node &node)
Converts the provided node into a json object.
Definition Node.cpp:990
constexpr Frequency_ Freq_All
All Frequencies.
Frequency_
Enumerate for GNSS frequencies.
Definition Frequency.hpp:26
@ E07
Galileo E5b (1207.14 MHz).
Definition Frequency.hpp:34
@ R03
GLONASS, "G3" (1202.025 MHz).
Definition Frequency.hpp:38
@ J01
QZSS L1 (1575.42 MHz).
Definition Frequency.hpp:47
@ B02
Beidou B1-2 (B1I) (1561.098 MHz).
Definition Frequency.hpp:42
@ S01
SBAS L1 (1575.42 MHz).
Definition Frequency.hpp:53
@ E06
Galileo E6 (1278.75 MHz).
Definition Frequency.hpp:33
@ Freq_None
None.
Definition Frequency.hpp:27
@ I09
IRNSS S (2492.028 MHz).
Definition Frequency.hpp:52
@ B05
Beidou B2a (1176.45 MHz).
Definition Frequency.hpp:43
@ I05
IRNSS L5 (1176.45 MHz).
Definition Frequency.hpp:51
@ R02
GLONASS, "G2" (1246 MHz).
Definition Frequency.hpp:37
@ B08
Beidou B2 (B2a + B2b) (1191.795MHz).
Definition Frequency.hpp:46
@ R06
GLONASS, "G2a" (1248.06 MHz).
Definition Frequency.hpp:40
@ E01
Galileo, "E1" (1575.42 MHz).
Definition Frequency.hpp:31
@ B06
Beidou B3 (1268.52 MHz).
Definition Frequency.hpp:44
@ E05
Galileo E5a (1176.45 MHz).
Definition Frequency.hpp:32
@ S05
SBAS L5 (1176.45 MHz).
Definition Frequency.hpp:54
@ G02
GPS L2 (1227.6 MHz).
Definition Frequency.hpp:29
@ R01
GLONASS, "G1" (1602 MHZ).
Definition Frequency.hpp:36
@ G01
GPS L1 (1575.42 MHz).
Definition Frequency.hpp:28
@ B01
Beidou B1 (1575.42 MHz).
Definition Frequency.hpp:41
@ J05
QZSS L5 (1176.45 MHz).
Definition Frequency.hpp:49
@ J02
QZSS L2 (1227.6 MHz).
Definition Frequency.hpp:48
@ B07
Beidou B2b (B2I) (1207.14 MHz).
Definition Frequency.hpp:45
@ R04
GLONASS, "G1a" (1600.995 MHZ).
Definition Frequency.hpp:39
@ E08
Galileo E5 (E5a + E5b) (1191.795MHz).
Definition Frequency.hpp:35
@ J06
QZSS L6 / LEX (1278.75 MHz).
Definition Frequency.hpp:50
@ G05
GPS L5 (1176.45 MHz).
Definition Frequency.hpp:30
bool ShowFrequencySelector(const char *label, Frequency &frequency, bool singleSelect)
Shows a ComboBox to select GNSS frequencies.
constexpr Frequency_ operator~(Frequency_ rhs)
Allows negating flags of the Frequency enum.
constexpr Frequency_ & operator&=(Frequency_ &lhs, const Frequency_ &rhs)
Allows combining flags of the Frequency enum.
Code operator&(const Code &lhs, const Code &rhs)
Definition Code.cpp:697
void from_json(const json &j, Node &node)
Converts the provided json object into a node object.
Definition Node.cpp:1007
constexpr Frequency_ & operator|=(Frequency_ &lhs, const Frequency_ &rhs)
Allows combining flags of the Frequency enum.
constexpr bool operator!=(const Node::Kind &lhs, const Node::Kind &rhs)
Inequal compares Node::Kind values.
Definition Node.hpp:506
constexpr bool operator==(const Node::Kind &lhs, const Node::Kind &rhs)
Equal compares Node::Kind values.
Definition Node.hpp:501
Code operator|(const Code &lhs, const Code &rhs)
Definition Code.cpp:673
SatelliteSystem_
Satellite System enumeration.
Satellite System type.
std::size_t operator()(const NAV::Frequency &f) const
Hash function for Frequency.
std::size_t operator()(const NAV::Frequency_ &f) const
Hash function for Frequency.