libdrmconf 0.12.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
16{
17 Q_OBJECT
18
19public:
21 {
22 protected:
24 enum class ToneType {
25 None = 0, CTCSS = 1, DCS = 2
26 };
27
28 protected:
30 SatelliteElement(uint8_t *ptr, size_t size);
31
32 public:
34 explicit SatelliteElement(uint8_t *ptr);
35
36 static constexpr unsigned int size() { return 0x200; }
37
38 void clear();
39
41 void setName(const QString &name);
42
44 void setEpoch(const OrbitalElement::Epoch &epoch);
46 void setMeanMotionDerivative(double dmm);
48 void setInclination(double incl);
50 void setAscension(double asc);
52 void setEccentricity(double ecc);
54 void setPerigee(double peri);
56 void setAnomaly(double ma);
58 void setMeanMotion(double mm);
60 void setRevolution(unsigned int num);
61
63 void setDownlink(const Frequency &f);
65 void setDownlinkTone(const SelectiveCall &tone);
67 void setUplink(const Frequency &f);
69 void setUplinkTone(const SelectiveCall &tone);
70
72 bool encode(const Satellite &sat, const ErrorStack &err=ErrorStack());
73
74 public:
76 struct Limit: Element::Limit {
78 static constexpr unsigned int name() { return 8; }
79 };
80
81 protected:
83 struct Offset: Element::Offset {
85 static constexpr unsigned int name() { return 0x0000; }
86 static constexpr unsigned int epochYear() { return 0x0008; }
87 static constexpr unsigned int epochDay() { return 0x000a; }
88 static constexpr unsigned int meanMotionDerivative() { return 0x0017; }
89 static constexpr unsigned int inclination() { return 0x0021; }
90 static constexpr unsigned int ascension() { return 0x002a; }
91 static constexpr unsigned int eccentricity() { return 0x0033; }
92 static constexpr unsigned int perigee() { return 0x003b; }
93 static constexpr unsigned int anomaly() { return 0x0044; }
94 static constexpr unsigned int meanMotion() { return 0x004d; }
95 static constexpr unsigned int revolution() { return 0x0058; }
96 static constexpr unsigned int downlinkFrequency() { return 0x0060; }
97 static constexpr unsigned int uplinkFrequency() { return 0x0064; }
98 static constexpr unsigned int uplinkToneType() { return 0x0068; }
99 static constexpr unsigned int downlinkToneType() { return 0x0069; }
100 static constexpr unsigned int uplinkCTCSS() { return 0x006a; }
101 static constexpr unsigned int downlinkCTCSS() { return 0x006b; }
102 static constexpr unsigned int uplinkDCS() { return 0x006c; }
103 static constexpr unsigned int downlinkDCS() { return 0x006e; }
105 };
106 };
107
108public:
110 explicit AnytoneSatelliteConfig(QObject *parent = nullptr);
111
112 SatelliteElement satellite(unsigned int idx);
113 bool encode(SatelliteDatabase *db, const ErrorStack &err=ErrorStack());
114
115public:
117 struct Limit {
118 static constexpr unsigned int satellites() { return 200; }
119 };
120
121protected:
123 struct Offset {
125 static constexpr unsigned int satellites() { return 0x2ec0000; }
126 static constexpr unsigned int betweenSatellites() { return SatelliteElement::size(); }
128 };
129};
130
131#endif // ANYTONE_SATELLITECONFIG_HH
Definition anytone_satelliteconfig.hh:21
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:24
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:52
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:41
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:117
Some internal offsets.
Definition anytone_satelliteconfig.hh:123
Some limits for the satellite.
Definition anytone_satelliteconfig.hh:76
static constexpr unsigned int name()
Maximum size of satellite name.
Definition anytone_satelliteconfig.hh:78
Some internal offsets.
Definition anytone_satelliteconfig.hh:83
Helper type to encode frequencies without any rounding error.
Definition frequency.hh:11
Represents a Julien day epoch since a specified year.
Definition orbitalelementsdatabase.hh:18
Encodes a selective call.
Definition signaling.hh:13