libdrmconf 0.12.3
A library to program DMR radios.
 
Loading...
Searching...
No Matches
opengd77base_satelliteconfig.hh
1#ifndef OPENGD77BASE_SATELLITECONFIG_HH
2#define OPENGD77BASE_SATELLITECONFIG_HH
3
4#include <orbitalelementsdatabase.hh>
5#include <satelliteconfig.hh>
6#include <frequency.hh>
7#include <signaling.hh>
8#include <satellitedatabase.hh>
9#include <codeplug.hh>
10
11
15{
16 Q_OBJECT
17
18public:
20 enum ImageType { EEPROM = 0, FLASH = 1 };
21
22public:
26 {
27 protected:
29 SatelliteElement(uint8_t *ptr, size_t size);
30
31 public:
33 SatelliteElement(uint8_t *ptr);
34
36 static constexpr unsigned int size() { return 0x0064; }
37
38 void clear();
39
41 virtual void setName(const QString &name);
42
44 virtual void setEpoch(const ::OrbitalElement::Epoch &epoch);
46 virtual void setMeanMotion(double mm);
48 virtual void setMeanMotionDerivative(double dmm);
50 virtual void setInclination(double incl);
52 virtual void setAscension(double asc);
54 virtual void setEccentricity(double ecc);
56 virtual void setPerigee(double arg);
58 virtual void setMeanAnomaly(double ma);
60 virtual void setRevolutionNumber(unsigned int num);
61
63 void setFMDownlink(const Frequency &f);
65 void setFMUplink(const Frequency &f);
67 void setCTCSS(const SelectiveCall &call);
69 void setAPRSDownlink(const Frequency &f);
71 void setAPRSUplink(const Frequency &f);
72
74 void setBeacon(const Frequency &f);
75
77 void setAPRSPath(const QString &path);
78
80 virtual bool encode(const Satellite &sat, const ErrorStack &err = ErrorStack());
81
82 protected:
91 void writeFixedPoint(const Offset::Bit &offset, double value, bool sign, unsigned int dec, unsigned int frac);
99 void writeFractional(const Offset::Bit &offset, double value, bool sign, unsigned int frac);
101 void writeInteger(const Offset::Bit &offset, int value, bool sign, unsigned dec);
103 void writeDigit(const Offset::Bit &offset, uint8_t digit);
104
105 public:
107 struct Limit: public Element::Limit {
109 static constexpr unsigned int nameLength() { return 8; }
111 static constexpr unsigned int pathLength() { return 24; }
112 };
113
114 protected:
116 struct Offset: public Element::Offset {
118 static constexpr unsigned int name() { return 0x0000; }
119 static constexpr Bit epochYear() { return {0x0008, 4}; }
120 static constexpr Bit epochJulienDay() { return {0x0009, 4}; }
121 static constexpr Bit meanMotionDerivative() { return {0x000f, 4}; }
122 static constexpr Bit inclination() { return {0x0014, 4}; }
123 static constexpr Bit ascension() { return {0x0018, 4}; }
124 static constexpr Bit eccentricity() { return {0x001c, 4}; }
125 static constexpr Bit perigee() { return {0x001f, 0}; }
126 static constexpr Bit meanAnomaly() { return {0x0023, 0}; }
127 static constexpr Bit meanMotion() { return {0x0027, 0}; }
128 static constexpr Bit revolutionNumber() { return {0x002d, 4}; }
129 static constexpr unsigned int fmDownlink() { return 0x0030; }
130 static constexpr unsigned int fmUplink() { return 0x0034; }
131 static constexpr unsigned int ctcss() { return 0x0038; }
132 static constexpr unsigned int aprsDownlink() { return 0x003c; }
133 static constexpr unsigned int aprsUplink() { return 0x0040; }
134 static constexpr unsigned int beacon() { return 0x0044; }
135 static constexpr unsigned int aprsPath() { return 0x004c; }
137 };
138 };
139
140
143 {
144 protected:
146 SatelliteBankElement(uint8_t *ptr, size_t size);
147
148 public:
150 SatelliteBankElement(uint8_t *ptr);
151
153 static constexpr unsigned int size() { return 0x09d8; }
154
155 void clear();
156
158 SatelliteElement satellite(unsigned int idx);
160 bool encode(SatelliteDatabase *db, const ErrorStack &err=ErrorStack());
161
162 public:
164 struct Limit {
166 static constexpr unsigned int satellites() { return 25; }
167 };
168
169 protected:
171 struct Offset {
173 static constexpr unsigned int label() { return 0x0000; }
174 static constexpr unsigned int unknownInteger0() { return 0x0008; }
175 static constexpr unsigned int unknownInteger1() { return 0x000c; }
176 static constexpr unsigned int segmentSize() { return 0x0010; }
177 static constexpr unsigned int satellites() { return 0x0014; }
178 static constexpr unsigned int betweenSatellites() { return SatelliteElement::size(); }
180 };
181 };
182
183public:
185 explicit OpenGD77BaseSatelliteConfig(QObject *parent = nullptr);
186
188 virtual bool encode(SatelliteDatabase *db, const ErrorStack &err=ErrorStack()) = 0;
189};
190
191#endif // OPENGD77BASE_SATELLITECONFIG_HH
Represents the abstract base class of all codeplug elements.
Definition codeplug.hh:52
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:41
SatelliteBankElement(uint8_t *ptr, size_t size)
Hidden constructor.
Definition opengd77base_satelliteconfig.cc:231
bool encode(SatelliteDatabase *db, const ErrorStack &err=ErrorStack())
Encodes the given satellite database.
Definition opengd77base_satelliteconfig.cc:260
void clear()
Abstract method to reset the element within the codeplug.
Definition opengd77base_satelliteconfig.cc:245
static constexpr unsigned int size()
The size of the element.
Definition opengd77base_satelliteconfig.hh:153
SatelliteElement satellite(unsigned int idx)
Returns the i-th satellite.
Definition opengd77base_satelliteconfig.cc:255
Encodes a satellite for the OpenGD77 devices.
Definition opengd77base_satelliteconfig.hh:26
virtual void setEccentricity(double ecc)
Sets eccentricity.
Definition opengd77base_satelliteconfig.cc:130
void setFMUplink(const Frequency &f)
Sets the uplink frequency.
Definition opengd77base_satelliteconfig.cc:161
void setFMDownlink(const Frequency &f)
Sets the downlink frequency.
Definition opengd77base_satelliteconfig.cc:156
void writeFractional(const Offset::Bit &offset, double value, bool sign, unsigned int frac)
Writes a fixed point value as a BCD number.
Definition opengd77base_satelliteconfig.cc:63
virtual void setPerigee(double arg)
Sets argument of perigee.
Definition opengd77base_satelliteconfig.cc:135
void writeFixedPoint(const Offset::Bit &offset, double value, bool sign, unsigned int dec, unsigned int frac)
Writes a fixed point value as a BCD number.
Definition opengd77base_satelliteconfig.cc:89
static constexpr unsigned int size()
The size of the element.
Definition opengd77base_satelliteconfig.hh:36
void clear()
Abstract method to reset the element within the codeplug.
Definition opengd77base_satelliteconfig.cc:22
virtual void setMeanMotionDerivative(double dmm)
Sets the first derivative of mean motion.
Definition opengd77base_satelliteconfig.cc:115
virtual void setName(const QString &name)
Sets the name of the element.
Definition opengd77base_satelliteconfig.cc:104
virtual bool encode(const Satellite &sat, const ErrorStack &err=ErrorStack())
Encodes a satellite.
Definition opengd77base_satelliteconfig.cc:196
virtual void setInclination(double incl)
Sets the inclination.
Definition opengd77base_satelliteconfig.cc:120
void writeInteger(const Offset::Bit &offset, int value, bool sign, unsigned dec)
Write a fixed digit integer value.
Definition opengd77base_satelliteconfig.cc:41
virtual void setAscension(double asc)
Right ascension of the ascending node.
Definition opengd77base_satelliteconfig.cc:125
void setBeacon(const Frequency &f)
Sets the beacon frequency.
Definition opengd77base_satelliteconfig.cc:184
void setAPRSPath(const QString &path)
Sets the APRS path.
Definition opengd77base_satelliteconfig.cc:190
virtual void setMeanMotion(double mm)
Sets the first derivative of mean motion.
Definition opengd77base_satelliteconfig.cc:145
void setAPRSDownlink(const Frequency &f)
Sets the APRS downlink frequency.
Definition opengd77base_satelliteconfig.cc:173
void setCTCSS(const SelectiveCall &call)
Sets the CTCSS tone.
Definition opengd77base_satelliteconfig.cc:166
void setAPRSUplink(const Frequency &f)
Sets the APRS uplink frequency.
Definition opengd77base_satelliteconfig.cc:178
virtual void setMeanAnomaly(double ma)
Set the mean anomaly.
Definition opengd77base_satelliteconfig.cc:140
SatelliteElement(uint8_t *ptr, size_t size)
Hidden constructor.
Definition opengd77base_satelliteconfig.cc:8
void writeDigit(const Offset::Bit &offset, uint8_t digit)
Writes a single digit at the given offset.
Definition opengd77base_satelliteconfig.cc:28
virtual void setRevolutionNumber(unsigned int num)
Sets the revolution number at epoch.
Definition opengd77base_satelliteconfig.cc:150
virtual void setEpoch(const ::OrbitalElement::Epoch &epoch)
Sets the epoch.
Definition opengd77base_satelliteconfig.cc:109
ImageType
Possible image types.
Definition opengd77base_satelliteconfig.hh:20
OpenGD77BaseSatelliteConfig(QObject *parent=nullptr)
Default constructor.
Definition opengd77base_satelliteconfig.cc:287
virtual bool encode(SatelliteDatabase *db, const ErrorStack &err=ErrorStack())=0
Encodes the given satellite database.
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
Helper type to encode frequencies without any rounding error.
Definition frequency.hh:11
Some limits for the satellite config.
Definition opengd77base_satelliteconfig.hh:164
static constexpr unsigned int satellites()
The maximum number of satellites.
Definition opengd77base_satelliteconfig.hh:166
Some internal offsets.
Definition opengd77base_satelliteconfig.hh:171
Some limits for the zone bank.
Definition opengd77base_satelliteconfig.hh:107
static constexpr unsigned int nameLength()
The maximum name length.
Definition opengd77base_satelliteconfig.hh:109
static constexpr unsigned int pathLength()
Maximum length of the APRS path.
Definition opengd77base_satelliteconfig.hh:111
Some internal offsets within the element.
Definition opengd77base_satelliteconfig.hh:116
Encodes a selective call.
Definition signaling.hh:13