libdrmconf 0.13.3
A library to program DMR radios.
Loading...
Searching...
No Matches
anytone_satelliteconfig.hh
1#ifndef ANYTONE_SATELLITECONFIG_HH
2#define ANYTONE_SATELLITECONFIG_HH
3
4#include "satelliteconfig.hh"
5#include "frequency.hh"
6#include "signaling.hh"
7#include "codeplug.hh"
8#include "orbitalelementsdatabase.hh"
9
10// Forward declarations
11class Satellite;
12
19{
20 Q_OBJECT
21
22public:
24 {
25 protected:
27 enum class ToneType {
28 None = 0, CTCSS = 1, DCS = 2
29 };
30
31 protected:
33 SatelliteElement(uint8_t *ptr, size_t size);
34
35 public:
37 explicit SatelliteElement(uint8_t *ptr);
38
39 static constexpr unsigned int size() { return 0x200; }
40
41 void clear();
42
44 void setName(const QString &name);
45
47 void setEpoch(const OrbitalElement::Epoch &epoch);
49 void setMeanMotionDerivative(double dmm);
51 void setInclination(double incl);
53 void setAscension(double asc);
55 void setEccentricity(double ecc);
57 void setPerigee(double peri);
59 void setAnomaly(double ma);
61 void setMeanMotion(double mm);
63 void setRevolution(unsigned int num);
64
66 void setDownlink(const Frequency &f);
68 void setDownlinkTone(const SelectiveCall &tone);
70 void setUplink(const Frequency &f);
72 void setUplinkTone(const SelectiveCall &tone);
73
75 bool encode(const Satellite &sat, const ErrorStack &err=ErrorStack());
76
77 public:
79 struct Limit: Element::Limit {
81 static constexpr unsigned int name() { return 8; }
82 };
83
84 protected:
86 struct Offset: Element::Offset {
88 static constexpr unsigned int name() { return 0x0000; }
89 static constexpr unsigned int epochYear() { return 0x0008; }
90 static constexpr unsigned int epochDay() { return 0x000a; }
91 static constexpr unsigned int meanMotionDerivative() { return 0x0017; }
92 static constexpr unsigned int inclination() { return 0x0021; }
93 static constexpr unsigned int ascension() { return 0x002a; }
94 static constexpr unsigned int eccentricity() { return 0x0033; }
95 static constexpr unsigned int perigee() { return 0x003b; }
96 static constexpr unsigned int anomaly() { return 0x0044; }
97 static constexpr unsigned int meanMotion() { return 0x004d; }
98 static constexpr unsigned int revolution() { return 0x0058; }
99 static constexpr unsigned int downlinkFrequency() { return 0x0060; }
100 static constexpr unsigned int uplinkFrequency() { return 0x0064; }
101 static constexpr unsigned int uplinkToneType() { return 0x0068; }
102 static constexpr unsigned int downlinkToneType() { return 0x0069; }
103 static constexpr unsigned int uplinkCTCSS() { return 0x006a; }
104 static constexpr unsigned int downlinkCTCSS() { return 0x006b; }
105 static constexpr unsigned int uplinkDCS() { return 0x006c; }
106 static constexpr unsigned int downlinkDCS() { return 0x006e; }
108 };
109 };
110
111public:
113 explicit AnytoneSatelliteConfig(QObject *parent = nullptr);
114
115 SatelliteElement satellite(unsigned int idx);
116 bool encode(SatelliteDatabase *db, const ErrorStack &err=ErrorStack());
117
118public:
120 struct Limit {
121 static constexpr unsigned int satellites() { return 200; }
122 };
123
124protected:
126 struct Offset {
128 static constexpr unsigned int satellites() { return 0x2ec0000; }
129 static constexpr unsigned int betweenSatellites() { return SatelliteElement::size(); }
131 };
132};
133
134#endif // ANYTONE_SATELLITECONFIG_HH
Definition anytone_satelliteconfig.hh:24
void clear()
Abstract method to reset the element within the codeplug.
Definition anytone_satelliteconfig.cc:23
void setAnomaly(double ma)
Sets the mean anomaly.
Definition anytone_satelliteconfig.cc:100
bool encode(const Satellite &sat, const ErrorStack &err=ErrorStack())
Encodes the given satellite.
Definition anytone_satelliteconfig.cc:171
void setUplink(const Frequency &f)
Sets the uplink frequency.
Definition anytone_satelliteconfig.cc:150
void setEccentricity(double ecc)
Sets the eccentricity.
Definition anytone_satelliteconfig.cc:82
void setInclination(double incl)
Sets the inclination.
Definition anytone_satelliteconfig.cc:58
void setName(const QString &name)
Sets the satellite name.
Definition anytone_satelliteconfig.cc:29
void setUplinkTone(const SelectiveCall &tone)
Sets the uplink sub tone.
Definition anytone_satelliteconfig.cc:155
void setMeanMotionDerivative(double dmm)
Sets the derivative of the mean motion.
Definition anytone_satelliteconfig.cc:50
void setMeanMotion(double mm)
Sets the mean motion.
Definition anytone_satelliteconfig.cc:112
void setDownlinkTone(const SelectiveCall &tone)
Sets the downlink sub tone.
Definition anytone_satelliteconfig.cc:135
void setDownlink(const Frequency &f)
Sets the downlink frequency.
Definition anytone_satelliteconfig.cc:130
void setEpoch(const OrbitalElement::Epoch &epoch)
Sets the epoch of the orbital element.
Definition anytone_satelliteconfig.cc:34
ToneType
Internal encoding of sub tone type.
Definition anytone_satelliteconfig.hh:27
void setPerigee(double peri)
Sets the argument of perigee.
Definition anytone_satelliteconfig.cc:88
void setRevolution(unsigned int num)
Sets the revolution number.
Definition anytone_satelliteconfig.cc:124
SatelliteElement(uint8_t *ptr, size_t size)
Hidden constructor.
Definition anytone_satelliteconfig.cc:10
void setAscension(double asc)
Sets the right ascension of the ascending node.
Definition anytone_satelliteconfig.cc:70
bool encode(SatelliteDatabase *db, const ErrorStack &err=ErrorStack())
Encodes the given satellite db into the device specific satellite configuration.
Definition anytone_satelliteconfig.cc:212
AnytoneSatelliteConfig(QObject *parent=nullptr)
Default constructor.
Definition anytone_satelliteconfig.cc:198
Represents the abstract base class of all codeplug elements.
Definition codeplug.hh:65
uint32_t size() const
Returns the total size of the DFU file.
Definition dfufile.cc:52
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:43
SatelliteConfig(QObject *parent=nullptr)
Hidden constructor.
Definition satelliteconfig.cc:3
A table holding all known satellites.
Definition satellitedatabase.hh:108
Extends the OrbitalElement to include transponder information for a satellite.
Definition satellitedatabase.hh:18
Some limits for the satellite config.
Definition anytone_satelliteconfig.hh:120
Some internal offsets.
Definition anytone_satelliteconfig.hh:126
Some limits for the satellite.
Definition anytone_satelliteconfig.hh:79
static constexpr unsigned int name()
Maximum size of satellite name.
Definition anytone_satelliteconfig.hh:81
Some internal offsets.
Definition anytone_satelliteconfig.hh:86
Helper type to encode frequencies without any rounding error.
Definition frequency.hh:107
Represents a Julien day epoch since a specified year.
Definition orbitalelementsdatabase.hh:18
Encodes a selective call.
Definition signaling.hh:13