14#include <imgui_internal.h>
24 if (typeString ==
"B1" || typeString ==
"B01" || typeString ==
"C01") {
return B01; }
25 if (typeString ==
"B2" || typeString ==
"B08" || typeString ==
"C08") {
return B08; }
26 if (typeString ==
"B3" || typeString ==
"B06" || typeString ==
"C06") {
return B06; }
27 if (typeString ==
"B1-2" || typeString ==
"B02" || typeString ==
"C02") {
return B02; }
28 if (typeString ==
"B2a" || typeString ==
"B05" || typeString ==
"C05") {
return B05; }
29 if (typeString ==
"B2b" || typeString ==
"B07" || typeString ==
"C07") {
return B07; }
30 if (typeString ==
"E1" || typeString ==
"E01") {
return E01; }
31 if (typeString ==
"E5a" || typeString ==
"E05") {
return E05; }
32 if (typeString ==
"E6" || typeString ==
"E06") {
return E06; }
33 if (typeString ==
"E5b" || typeString ==
"E07") {
return E07; }
34 if (typeString ==
"E5" || typeString ==
"E08") {
return E08; }
35 if (typeString ==
"L1" || typeString ==
"G01") {
return G01; }
36 if (typeString ==
"L2" || typeString ==
"G02") {
return G02; }
37 if (typeString ==
"L5" || typeString ==
"G05") {
return G05; }
38 if (typeString ==
"I5" || typeString ==
"I05") {
return I05; }
39 if (typeString ==
"IS" || typeString ==
"I09") {
return I09; }
40 if (typeString ==
"Q1" || typeString ==
"J01") {
return J01; }
41 if (typeString ==
"Q2" || typeString ==
"J02") {
return J02; }
42 if (typeString ==
"Q5" || typeString ==
"J05") {
return J05; }
43 if (typeString ==
"Q6" || typeString ==
"QLEX" || typeString ==
"J06") {
return J06; }
44 if (typeString ==
"G1" || typeString ==
"R01") {
return R01; }
45 if (typeString ==
"G2" || typeString ==
"R02") {
return R02; }
46 if (typeString ==
"G3" || typeString ==
"R03") {
return R03; }
47 if (typeString ==
"G1a" || typeString ==
"R04") {
return R04; }
48 if (typeString ==
"G2a" || typeString ==
"R06") {
return R06; }
49 if (typeString ==
"S1" || typeString ==
"S01") {
return S01; }
50 if (typeString ==
"S5" || typeString ==
"S05") {
return S05; }
120Frequency::operator std::string()
const
122 const std::string filler =
" | ";
126 str += (!
str.empty() ? filler :
"") +
"L1";
130 str += (!
str.empty() ? filler :
"") +
"L2";
134 str += (!
str.empty() ? filler :
"") +
"L5";
138 str += (!
str.empty() ? filler :
"") +
"E1";
142 str += (!
str.empty() ? filler :
"") +
"E5a";
146 str += (!
str.empty() ? filler :
"") +
"E6";
150 str += (!
str.empty() ? filler :
"") +
"E5b";
154 str += (!
str.empty() ? filler :
"") +
"E5";
158 str += (!
str.empty() ? filler :
"") +
"G1";
162 str += (!
str.empty() ? filler :
"") +
"G2";
166 str += (!
str.empty() ? filler :
"") +
"G3";
170 str += (!
str.empty() ? filler :
"") +
"G1a";
174 str += (!
str.empty() ? filler :
"") +
"G2a";
178 str += (!
str.empty() ? filler :
"") +
"B1";
182 str += (!
str.empty() ? filler :
"") +
"B2";
186 str += (!
str.empty() ? filler :
"") +
"B3";
190 str += (!
str.empty() ? filler :
"") +
"B1-2";
194 str += (!
str.empty() ? filler :
"") +
"B2a";
198 str += (!
str.empty() ? filler :
"") +
"B2b";
202 str += (!
str.empty() ? filler :
"") +
"Q1";
206 str += (!
str.empty() ? filler :
"") +
"Q2";
210 str += (!
str.empty() ? filler :
"") +
"Q5";
214 str += (!
str.empty() ? filler :
"") +
"Q6";
218 str += (!
str.empty() ? filler :
"") +
"I5";
222 str += (!
str.empty() ? filler :
"") +
"IS";
226 str += (!
str.empty() ? filler :
"") +
"S1";
230 str += (!
str.empty() ? filler :
"") +
"S5";
245 if (freq & satSys) { retVal |= satSys; }
295 INS_ASSERT_USER_ERROR(num >= -7 && num <= 6,
"GLONASS G1 frequency numbers have to be in the range [-7, +6] (all satellites launched after 2005)");
296 return (1602.0 + num * 9.0 / 16.0) * 1e6;
298 INS_ASSERT_USER_ERROR(num >= -7 && num <= 6,
"GLONASS G1 frequency numbers have to be in the range [-7, +6] (all satellites launched after 2005)");
299 return (1246.0 + num * 7.0 / 16.0) * 1e6;
467 std::vector<Frequency> v;
470 if (f.value & freq.
value) { v.push_back(f); }
492 auto frequencies =
Frequency(f).toVector();
493 return std::ranges::all_of(frequencies,
499 j = std::string(data);
508 bool valueChanged =
false;
509 if (ImGui::BeginCombo(label, std::string(frequency).c_str(), ImGuiComboFlags_HeightLargest))
511 if (ImGui::BeginTable(fmt::format(
"{} Table", label).c_str(), 7, ImGuiTableFlags_BordersInnerV))
513 for (uint64_t satSys = 0xFF; satSys < 0xFFUL << (7 * 8); satSys = satSys << 8UL)
517 ImGui::TableHeadersRow();
518 for (uint64_t f = 0; f < 8; f++)
520 ImGui::TableNextRow();
521 for (
int c = 0; c < 7; c++)
523 uint64_t flag = (1UL << (f +
static_cast<uint64_t
>(c) * 8));
529 ImGui::TableSetColumnIndex(c);
532 ImGui::BeginDisabled();
537 if (ImGui::Checkbox(text.c_str(), &selected) && frequency !=
Frequency_(flag))
546 if (ImGui::CheckboxFlags(text.c_str(), &value, flag))
554 ImGui::EndDisabled();
569 return os << fmt::format(
"{}", obj);
#define INS_ASSERT_USER_ERROR(_EXP, _MSG)
Assert function with message.
nlohmann::json json
json namespace
std::ostream & operator<<(std::ostream &os, const NAV::Frequency &obj)
Stream insertion operator overload.
Frequency definition for different satellite systems.
Utility class for logging to console and file.
Frequency definition for different satellite systems.
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.
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.
Enum
Satellite System enumeration with continuous range. Not usable as a mask.
@ Enum_R02
GLONASS, "G2" (1246 MHz).
@ Enum_R03
GLONASS, "G3" (1202.025 MHz).
@ Enum_B08
Beidou B2 (B2a + B2b) (1191.795MHz).
@ Enum_J05
QZSS L5 (1176.45 MHz).
@ Enum_COUNT
Count variable.
@ Enum_E08
Galileo E5 (E5a + E5b) (1191.795MHz).
@ Enum_E01
Galileo, "E1" (1575.42 MHz).
@ Enum_B05
Beidou B2a (1176.45 MHz).
@ Enum_B07
Beidou B2b (1207.14 MHz).
@ Enum_R06
GLONASS, "G2a" (1248.06 MHz).
@ Enum_R01
GLONASS, "G1" (1602 MHZ).
@ Enum_R04
GLONASS, "G1a" (1600.995 MHZ).
@ Enum_S01
SBAS L1 (1575.42 MHz).
@ Enum_G05
GPS L5 (1176.45 MHz).
@ Enum_E07
Galileo E5b (1207.14 MHz).
@ Enum_G02
GPS L2 (1227.6 MHz).
@ Enum_G01
GPS L1 (1575.42 MHz).
@ Enum_I05
IRNSS L5 (1176.45 MHz).
@ Enum_I09
IRNSS S (2492.028 MHz).
@ Enum_S05
SBAS L5 (1176.45 MHz).
@ Enum_B02
Beidou B1-2 (1561.098 MHz).
@ Enum_J02
QZSS L2 (1227.6 MHz).
@ Enum_J06
QZSS L6 / LEX (1278.75 MHz).
@ Enum_E05
Galileo E5a (1176.45 MHz).
@ Enum_E06
Galileo E6 (1278.75 MHz).
@ Enum_J01
QZSS L1 (1575.42 MHz).
@ Enum_B06
Beidou B3 (1268.52 MHz).
@ Enum_B01
Beidou B1 (1575.42 MHz).
static Frequency fromString(const std::string &typeString)
Construct new object from std::string.
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.
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.
size_t count() const
Counts the amount of frequencies contained.
static SatelliteSystem GetSatelliteSystemForFrequency(Frequency freq)
Get the Time System of the specified Frequency.
void to_json(json &j, const Node &node)
Converts the provided node into a json object.
Frequency_
Enumerate for GNSS frequencies.
@ E07
Galileo E5b (1207.14 MHz).
@ R03
GLONASS, "G3" (1202.025 MHz).
@ J01
QZSS L1 (1575.42 MHz).
@ B02
Beidou B1-2 (B1I) (1561.098 MHz).
@ S01
SBAS L1 (1575.42 MHz).
@ E06
Galileo E6 (1278.75 MHz).
@ I09
IRNSS S (2492.028 MHz).
@ B05
Beidou B2a (1176.45 MHz).
@ I05
IRNSS L5 (1176.45 MHz).
@ R02
GLONASS, "G2" (1246 MHz).
@ B08
Beidou B2 (B2a + B2b) (1191.795MHz).
@ R06
GLONASS, "G2a" (1248.06 MHz).
@ E01
Galileo, "E1" (1575.42 MHz).
@ B06
Beidou B3 (1268.52 MHz).
@ E05
Galileo E5a (1176.45 MHz).
@ S05
SBAS L5 (1176.45 MHz).
@ G02
GPS L2 (1227.6 MHz).
@ R01
GLONASS, "G1" (1602 MHZ).
@ G01
GPS L1 (1575.42 MHz).
@ B01
Beidou B1 (1575.42 MHz).
@ J05
QZSS L5 (1176.45 MHz).
@ J02
QZSS L2 (1227.6 MHz).
@ B07
Beidou B2b (B2I) (1207.14 MHz).
@ R04
GLONASS, "G1a" (1600.995 MHZ).
@ E08
Galileo E5 (E5a + E5b) (1191.795MHz).
@ J06
QZSS L6 / LEX (1278.75 MHz).
@ G05
GPS L5 (1176.45 MHz).
bool ShowFrequencySelector(const char *label, Frequency &frequency, bool singleSelect)
Shows a ComboBox to select GNSS frequencies.
void from_json(const json &j, Node &node)
Converts the provided json object into a node object.
SatelliteSystem_
Satellite System enumeration.
@ SatSys_None
No Satellite system.
static std::vector< SatelliteSystem > GetAll()
Returns a list with all possible satellite systems.