libdrmconf  0.10.4
A library to program DMR radios.
openrtx_codeplug.hh
1 #ifndef OPENRTX_CODEPLUG_HH
2 #define OPENRTX_CODEPLUG_HH
3 
4 #include "codeplug.hh"
5 #include "signaling.hh"
6 #include "channel.hh"
7 #include "contact.hh"
8 
9 class DMRContact;
10 class Zone;
11 class RXGroupList;
12 class ScanList;
13 
30 class OpenRTXCodeplug : public Codeplug
31 {
32  Q_OBJECT
33 
34 public:
36  enum Mode {
37  Mode_None = 0,
38  Mode_FM = 1,
39  Mode_DMR = 2,
40  Mode_M17 = 3
41  };
42 
43 public:
49  {
50  protected:
52  HeaderElement(uint8_t *ptr, size_t size);
53 
54  public:
56  HeaderElement(uint8_t *ptr);
57 
58  void clear();
59  bool isValid() const;
60 
62  virtual uint16_t version() const;
64  virtual void setVersion();
65 
67  virtual QString author() const;
69  virtual void setAuthor(const QString &name);
71  virtual QString description() const;
73  virtual void setDescription(const QString description);
74 
76  virtual QDateTime timestamp() const;
78  virtual void setTimestamp(const QDateTime timestamp=QDateTime::currentDateTime());
79 
81  virtual unsigned int contactCount() const;
83  virtual void setContactCount(unsigned int n);
85  virtual unsigned int channelCount() const;
87  virtual void setChannelCount(unsigned int n);
89  virtual unsigned int zoneCount() const;
91  virtual void setZoneCount(unsigned int n);
92 
93  protected:
95  enum Offsets {
96  OffsetMagic = 0x00, MagicNumber = 0x43585452, OffsetVersion = 0x08, OffsetAuthor = 0x0a,
97  OffsetDescription = 0x2a, OffsetTimestamp = 0x4a, OffsetContactCount = 0x52,
98  OffsetChannelCount = 0x54, OffsetZoneCount = 0x56, StringLength = 0x20,
99  SupportedVersion = ((0<<8)|1)
100  };
101  };
102 
108  {
109  public:
111  enum Bandwidth {
112  BW_12_5kHz = 0,
113  BW_20kHz = 1,
114  BW_25kHz = 2
115  };
116 
118  enum Timeslot {
119  Timeslot1 = 1,
120  Timeslot2 = 2
121  };
122 
124  enum ChannelMode {
125  M17Voice = 1,
126  M17Data = 2,
127  M17VoiceData = 3
128  };
129 
132  EncrNone = 0,
133  EncrAES256 = 1,
134  EncrScrambler = 2
135  };
136 
137  protected:
139  ChannelElement(uint8_t *ptr, size_t size);
140 
141  public:
143  explicit ChannelElement(uint8_t *ptr);
145  virtual ~ChannelElement();
146 
147  bool isValid() const;
148 
150  virtual void clear();
151 
153  virtual Mode mode() const;
155  virtual void setMode(Mode mode);
156 
158  virtual bool rxOnly() const;
160  virtual void setRXOnly(bool enable);
161 
163  virtual Bandwidth bandwidth() const;
165  virtual void setBandwidth(Bandwidth bw);
166 
168  virtual float power() const;
170  virtual void setPower(float dBm);
171 
173  virtual double rxFrequency() const;
175  virtual void setRXFrequency(double MHz);
177  virtual double txFrequency() const;
179  virtual void setTXFrequency(double MHz);
180 
182  virtual bool hasScanListIndex() const;
184  virtual unsigned int scanListIndex() const;
186  virtual void setScanListIndex(unsigned int index);
188  virtual void clearScanListIndex();
189 
191  virtual bool hasGroupListIndex() const;
193  virtual unsigned int groupListIndex() const;
195  virtual void setGroupListIndex(unsigned int index);
197  virtual void clearGroupListIndex();
198 
200  virtual QString name() const;
202  virtual void setName(const QString &name);
204  virtual QString description() const;
206  virtual void setDescription(const QString &description);
207 
209  virtual float latitude() const;
211  virtual void setLatitude(float lat);
213  virtual float longitude() const;
215  virtual void setLongitude(float lat);
217  virtual unsigned int altitude() const;
219  virtual void setAltitude(unsigned int alt);
220 
222  virtual Signaling::Code rxTone() const;
224  virtual void setRXTone(Signaling::Code code, const ErrorStack &err=ErrorStack());
226  virtual Signaling::Code txTone() const;
228  virtual void setTXTone(Signaling::Code code, const ErrorStack &err=ErrorStack());
229 
231  virtual unsigned int rxColorCode() const;
233  virtual void setRXColorCode(unsigned int cc);
235  virtual unsigned int txColorCode() const;
237  virtual void setTXColorCode(unsigned int cc);
238 
240  virtual DMRChannel::TimeSlot timeslot() const;
242  virtual void setTimeslot(DMRChannel::TimeSlot ts);
243 
245  virtual bool hasDMRContactIndex() const;
247  virtual unsigned int dmrContactIndex() const;
249  virtual void setDMRContactIndex(unsigned int idx);
251  virtual void clearDMRContactIndex();
252 
254  virtual unsigned int rxChannelAccessNumber() const;
256  virtual void setRXChannelAccessNumber(unsigned int cc);
258  virtual unsigned int txChannelAccessNumber() const;
260  virtual void setTXChannelAccessNumber(unsigned int cc);
261 
263  virtual EncryptionMode encryptionMode() const;
265  virtual void setEncryptionMode(EncryptionMode mode);
266 
268  virtual ChannelMode channelMode() const;
270  virtual void setChannelMode(ChannelMode mode);
271 
273  virtual bool gpsDataEnabled() const;
275  virtual void enableGPSData(bool enable);
276 
278  virtual bool hasM17ContactIndex() const;
280  virtual unsigned int m17ContactIndex() const;
282  virtual void setM17ContactIndex(unsigned int idx);
284  virtual void clearM17ContactIndex();
285 
287  virtual Channel *toChannelObj(Context &ctx, const ErrorStack &err=ErrorStack()) const;
289  virtual bool linkChannelObj(Channel *c, Context &ctx, const ErrorStack &err=ErrorStack()) const;
291  virtual bool fromChannelObj(const Channel *c, Context &ctx, const ErrorStack &err=ErrorStack());
292 
293  protected:
295  enum Offsets {
296  OffsetMode = 0x00, OffsetBandwidth = 0x01, BitBandwidth = 0x00, OffsetRXOnly = 0x01,
297  BitRXOnly = 0x02, OffsetPower = 0x02, OffsetRXFrequency = 0x03, OffsetTXFrequency = 0x07,
298  OffsetScanList = 0x0b, OffsetGroupList = 0x0c, OffsetName = 0x0d, OffsetDescription = 0x2d,
299  OffsetChLatInt = 0x4d, OffsetChLatDec = 0x4e, OffsetChLonInt = 0x50, OffsetChLonDec = 0x51,
300  OffsetChAltitude = 0x53, OffsetRXTone = 0x55, OffsetTXTone = 0x56, OffsetRXColorCode = 0x55,
301  BitRXColorCode = 0x00, OffsetTXColorCode = 0x55, BitTXColorCode = 0x04, OffsetTimeSlot = 0x56,
302  OffsetDMRContact = 0x57, OffsetRXCAN = 0x55, BitRXCAN = 0x00, OffsetTXCAN = 0x55,
303  BitTXCAN = 0x04, OffsetEncrMode = 0x56, BitEncrMode = 0x04, OffsetM17ChMode = 0x56,
304  BitM17ChMode = 0x00, OffsetM17GPSMode = 0x57, OffsetM17Contact = 0x58, StringLength = 0x20
305  };
306  };
307 
312  class ContactElement: public Element
313  {
314  protected:
316  ContactElement(uint8_t *ptr, unsigned size);
317 
318  public:
320  explicit ContactElement(uint8_t *ptr);
322  virtual ~ContactElement();
323 
325  void clear();
327  bool isValid() const;
328 
330  virtual QString name() const;
332  virtual void setName(const QString &name);
333 
335  virtual Mode mode() const;
337  virtual void setMode(Mode mode);
338 
340  virtual unsigned int dmrId() const;
342  virtual void setDMRId(unsigned int id);
343 
345  virtual bool dmrRing() const;
347  virtual void enableDMRRing(bool enable);
348 
350  virtual DMRContact::Type dmrContactType() const;
352  virtual void setDMRContactType(DMRContact::Type type);
353 
355  virtual QString m17Call() const;
357  virtual bool setM17Call(const QString &call, const ErrorStack &err=ErrorStack());
358 
360  virtual DMRContact *toContactObj(Context &ctx, const ErrorStack &err=ErrorStack()) const;
362  virtual void fromContactObj(const DMRContact *obj, Context &ctx, const ErrorStack &err=ErrorStack());
363 
364  protected:
366  enum Offsets {
367  OffsetName = 0x00, OffsetMode = 0x20, OffsetDMRId = 0x21, OffsetDMRCallType = 0x25,
368  BitDMRCallType = 0, OffsetDMRRing = 0x25, BitDMRRing = 0x02, OffsetM17Address = 0x21,
369  StringLength = 0x20
370  };
371 
372  };
373 
374 
380  {
381  protected:
383  ZoneElement(uint8_t *ptr, unsigned size);
384 
385  public:
387  explicit ZoneElement(uint8_t *ptr);
388  virtual ~ZoneElement();
389 
391  void clear();
393  bool isValid() const;
394 
396  virtual QString name() const;
398  virtual void setName(const QString &name);
399 
401  virtual unsigned int channelCount() const;
403  virtual void setChannelCount(unsigned int n);
404 
406  virtual unsigned int channelIndex(unsigned int n) const;
408  virtual void setChannelIndex(unsigned int n, unsigned int idx);
409 
411  virtual Zone *toZoneObj(Context &ctx) const;
414  virtual bool linkZoneObj(Zone *zone, Context &ctx, bool putInB, const ErrorStack &err=ErrorStack()) const;
416  virtual void fromZoneObjA(const Zone *zone, Context &ctx);
418  virtual void fromZoneObjB(const Zone *zone, Context &ctx);
419 
420  protected:
422  enum Offsets {
423  OffsetName = 0x00, OffsetCount = 0x20, OffsetChannel = 0x22, StringLength = 0x20
424  };
425  };
426 
427 public:
429  explicit OpenRTXCodeplug(QObject *parent=nullptr);
430 
432  virtual ~OpenRTXCodeplug();
433 
435  virtual void clear();
436 
437  bool index(Config *config, Context &ctx, const ErrorStack &err=ErrorStack()) const;
438 
440  bool decode(Config *config, const ErrorStack &err=ErrorStack());
442  bool encode(Config *config, const Flags &flags = Flags(), const ErrorStack &err=ErrorStack());
443 
444 public:
447  virtual bool decodeElements(Context &ctx, const ErrorStack &err=ErrorStack());
449  virtual bool encodeElements(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
450 
452  virtual unsigned int numContacts();
454  virtual unsigned int offsetContact(unsigned int n);
456  virtual bool encodeContacts(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
458  virtual bool createContacts(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
459 
461  virtual unsigned int numChannels();
463  virtual unsigned int offsetChannel(unsigned int n);
465  virtual bool encodeChannels(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
467  virtual bool createChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
469  virtual bool linkChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
470 
472  virtual unsigned int numZones();
474  virtual unsigned int offsetZoneOffsets();
476  virtual unsigned int offsetZone(unsigned int n);
478  virtual bool encodeZones(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
480  virtual bool createZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
482  virtual bool linkZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
483 
484 protected:
486  enum Offsets {
487  HeaderSize = 0x58, ChannelSize = 0x5a, ContactSize = 0x27, ZoneHeaderSize=0x22
488  };
489 };
490 
491 #endif // OPENRTX_CODEPLUG_HH
The base class of all channels (analog and digital) of a codeplug configuration.
Definition: channel.hh:32
Base class for all codeplug contexts.
Definition: codeplug.hh:195
Represents the abstract base class of all codeplug elements.
Definition: codeplug.hh:47
This class defines the interface all device-specific code-plugs must implement.
Definition: codeplug.hh:18
The config class, representing the codeplug configuration.
Definition: config.hh:67
uint32_t size() const
Returns the total size of the DFU file.
Definition: dfufile.cc:50
TimeSlot
Possible timeslots for digital channels.
Definition: channel.hh:380
Represents a digital contact, that is a DMR number.
Definition: contact.hh:140
Type
Possible call types for a contact.
Definition: contact.hh:154
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Implements the binary representation of a channel.
Definition: openrtx_codeplug.hh:108
virtual void setM17ContactIndex(unsigned int idx)
Sets the M17 contact index.
Definition: openrtx_codeplug.cc:507
EncryptionMode
Specifies the M17 encryption modes.
Definition: openrtx_codeplug.hh:131
virtual void clear()
Resets the channel.
Definition: openrtx_codeplug.cc:148
virtual void setName(const QString &name)
Sets the channel name.
Definition: openrtx_codeplug.cc:268
virtual unsigned int groupListIndex() const
Returns the group list index.
Definition: openrtx_codeplug.cc:247
virtual Mode mode() const
Returns the channel mode.
Definition: openrtx_codeplug.cc:154
virtual void setTXChannelAccessNumber(unsigned int cc)
Sets the TX color code.
Definition: openrtx_codeplug.cc:455
virtual void clearDMRContactIndex()
Clears the DMR contact index.
Definition: openrtx_codeplug.cc:435
virtual void setLatitude(float lat)
Sets the latitude.
Definition: openrtx_codeplug.cc:289
virtual void enableGPSData(bool enable)
Enables/disables sending of GPS position as meta-data.
Definition: openrtx_codeplug.cc:488
virtual float power() const
Power in dBm.
Definition: openrtx_codeplug.cc:187
Offsets
Just contains the offsets within the channel element.
Definition: openrtx_codeplug.hh:295
virtual unsigned int rxChannelAccessNumber() const
Returns the RX channel access number.
Definition: openrtx_codeplug.cc:440
virtual bool linkChannelObj(Channel *c, Context &ctx, const ErrorStack &err=ErrorStack()) const
Links a previously constructed channel to the rest of the configuration.
Definition: openrtx_codeplug.cc:569
virtual unsigned int altitude() const
Returns the height in meters.
Definition: openrtx_codeplug.cc:306
virtual void setAltitude(unsigned int alt)
Sets the height in meters.
Definition: openrtx_codeplug.cc:310
virtual void setScanListIndex(unsigned int index)
Sets the scan list index.
Definition: openrtx_codeplug.cc:231
virtual bool hasDMRContactIndex() const
Returns true if the DMR contact index is set.
Definition: openrtx_codeplug.cc:420
virtual ChannelMode channelMode() const
Returns the channel mode.
Definition: openrtx_codeplug.cc:472
virtual bool rxOnly() const
Returns true, if the channel is RX only.
Definition: openrtx_codeplug.cc:165
virtual float longitude() const
Returns the channel longitude.
Definition: openrtx_codeplug.cc:295
virtual void setRXFrequency(double MHz)
Sets the RX frequency in MHz.
Definition: openrtx_codeplug.cc:205
virtual void setRXTone(Signaling::Code code, const ErrorStack &err=ErrorStack())
Sets the CTCSS RX sub-tone.
Definition: openrtx_codeplug.cc:326
bool isValid() const
Returns true if the pointer is not null.
Definition: openrtx_codeplug.cc:143
virtual void setTXColorCode(unsigned int cc)
Sets the TX color code.
Definition: openrtx_codeplug.cc:398
virtual void clearScanListIndex()
Clears the scan list index.
Definition: openrtx_codeplug.cc:236
virtual unsigned int scanListIndex() const
Returns the scan list index.
Definition: openrtx_codeplug.cc:226
virtual unsigned int txChannelAccessNumber() const
Returns the TX color code.
Definition: openrtx_codeplug.cc:450
virtual void setPower(float dBm)
Set power in dBm.
Definition: openrtx_codeplug.cc:192
virtual unsigned int rxColorCode() const
Returns the RX color code.
Definition: openrtx_codeplug.cc:383
virtual bool hasM17ContactIndex() const
Returns true if the M17 contact index is set.
Definition: openrtx_codeplug.cc:497
virtual Signaling::Code rxTone() const
Returns the CTCSS RX sub-tone.
Definition: openrtx_codeplug.cc:316
virtual unsigned int dmrContactIndex() const
Returns the contact index for the DMR contact.
Definition: openrtx_codeplug.cc:425
virtual void setTimeslot(DMRChannel::TimeSlot ts)
Sets the timeslot for the channel.
Definition: openrtx_codeplug.cc:411
Bandwidth
Specifies the possible bandwidth settings.
Definition: openrtx_codeplug.hh:111
virtual void setMode(Mode mode)
Sets the channel mode.
Definition: openrtx_codeplug.cc:159
virtual ~ChannelElement()
Destructor.
Definition: openrtx_codeplug.cc:138
virtual void setDescription(const QString &description)
Sets the channel description.
Definition: openrtx_codeplug.cc:278
virtual void setRXChannelAccessNumber(unsigned int cc)
Sets the RX channel access number.
Definition: openrtx_codeplug.cc:445
virtual void setTXTone(Signaling::Code code, const ErrorStack &err=ErrorStack())
Sets the CTCSS TX sub-tone.
Definition: openrtx_codeplug.cc:359
virtual void setChannelMode(ChannelMode mode)
Sets the channel mode.
Definition: openrtx_codeplug.cc:477
ChannelElement(uint8_t *ptr, size_t size)
Constructs a channel from the given memory.
Definition: openrtx_codeplug.cc:126
virtual unsigned int txColorCode() const
Returns the TX color code.
Definition: openrtx_codeplug.cc:393
virtual void setLongitude(float lat)
Sets the longitude.
Definition: openrtx_codeplug.cc:300
virtual void setBandwidth(Bandwidth bw)
Sets the bandwidth of the channel.
Definition: openrtx_codeplug.cc:181
virtual EncryptionMode encryptionMode() const
Returns the encryption mode of the channel.
Definition: openrtx_codeplug.cc:461
virtual void setRXColorCode(unsigned int cc)
Sets the RX color code.
Definition: openrtx_codeplug.cc:388
Timeslot
Specifies the DMR time slot settings.
Definition: openrtx_codeplug.hh:118
virtual void setRXOnly(bool enable)
Enables/disables RX only for the channel.
Definition: openrtx_codeplug.cc:170
ChannelMode
Specifies the M17 channel mode.
Definition: openrtx_codeplug.hh:124
virtual unsigned int m17ContactIndex() const
Returns the M17 contact index.
Definition: openrtx_codeplug.cc:502
virtual DMRChannel::TimeSlot timeslot() const
Returns the times slot for the channel.
Definition: openrtx_codeplug.cc:404
virtual bool hasScanListIndex() const
Retrusn true if the scan list is set.
Definition: openrtx_codeplug.cc:221
virtual double txFrequency() const
Returns the TX frequency in MHz.
Definition: openrtx_codeplug.cc:210
virtual bool gpsDataEnabled() const
Returns true if GPS position is sent as meta-data.
Definition: openrtx_codeplug.cc:483
virtual QString description() const
Returns the channel description.
Definition: openrtx_codeplug.cc:273
virtual double rxFrequency() const
Returns the RX frequency in MHz.
Definition: openrtx_codeplug.cc:200
virtual Channel * toChannelObj(Context &ctx, const ErrorStack &err=ErrorStack()) const
Constructs a generic Channel object from the codeplug channel.
Definition: openrtx_codeplug.cc:518
virtual void setEncryptionMode(EncryptionMode mode)
Sets the encryption mode for the channel.
Definition: openrtx_codeplug.cc:466
virtual bool hasGroupListIndex() const
Retrusn true if the group list is set.
Definition: openrtx_codeplug.cc:242
virtual void clearM17ContactIndex()
Clears the M17 contact index.
Definition: openrtx_codeplug.cc:512
virtual float latitude() const
Returns the channel latitude.
Definition: openrtx_codeplug.cc:284
virtual void setTXFrequency(double MHz)
Sets the TX frequency in MHz.
Definition: openrtx_codeplug.cc:215
virtual void setDMRContactIndex(unsigned int idx)
Sets the DMR contact index.
Definition: openrtx_codeplug.cc:430
virtual Signaling::Code txTone() const
Returns the CTCSS TX sub-tone.
Definition: openrtx_codeplug.cc:349
virtual Bandwidth bandwidth() const
Returns the bandwidth of the channel.
Definition: openrtx_codeplug.cc:176
virtual bool fromChannelObj(const Channel *c, Context &ctx, const ErrorStack &err=ErrorStack())
Initializes this codeplug channel from the given generic configuration.
Definition: openrtx_codeplug.cc:616
virtual void clearGroupListIndex()
Clears the group list index.
Definition: openrtx_codeplug.cc:257
virtual QString name() const
Returns the channel name.
Definition: openrtx_codeplug.cc:263
virtual void setGroupListIndex(unsigned int index)
Sets the group list index.
Definition: openrtx_codeplug.cc:252
Implements the digital contact for the OpenRTX firmware.
Definition: openrtx_codeplug.hh:313
virtual bool dmrRing() const
Returns true if the RX tone is enabled (ring).
Definition: openrtx_codeplug.cc:721
virtual DMRContact * toContactObj(Context &ctx, const ErrorStack &err=ErrorStack()) const
Constructs a DigitalContact instance from this codeplug contact.
Definition: openrtx_codeplug.cc:786
Offsets
Just holds the offsets within the codeplug.
Definition: openrtx_codeplug.hh:366
virtual void enableDMRRing(bool enable)
Enables/disables RX tone (ring).
Definition: openrtx_codeplug.cc:726
virtual void setDMRContactType(DMRContact::Type type)
Sets the contact type.
Definition: openrtx_codeplug.cc:737
virtual QString name() const
Returns the name of the contact.
Definition: openrtx_codeplug.cc:688
virtual void setMode(Mode mode)
Sets the mode of the contact.
Definition: openrtx_codeplug.cc:704
virtual DMRContact::Type dmrContactType() const
Returns the contact type.
Definition: openrtx_codeplug.cc:732
virtual bool setM17Call(const QString &call, const ErrorStack &err=ErrorStack())
Sets the M17 call.
Definition: openrtx_codeplug.cc:755
bool isValid() const
Returns true if the contact is valid.
Definition: openrtx_codeplug.cc:682
virtual void setDMRId(unsigned int id)
Sets the DMR ID.
Definition: openrtx_codeplug.cc:715
void clear()
Resets the contact.
Definition: openrtx_codeplug.cc:677
virtual Mode mode() const
Returns the mode of the contact (either DMR or M17).
Definition: openrtx_codeplug.cc:699
virtual QString m17Call() const
Returns the contact call.
Definition: openrtx_codeplug.cc:743
ContactElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition: openrtx_codeplug.cc:660
virtual void fromContactObj(const DMRContact *obj, Context &ctx, const ErrorStack &err=ErrorStack())
Resets this codeplug contact from the given DigitalContact.
Definition: openrtx_codeplug.cc:809
virtual unsigned int dmrId() const
Returns the DMR ID.
Definition: openrtx_codeplug.cc:710
virtual void setName(const QString &name)
Sets the name of the contact.
Definition: openrtx_codeplug.cc:693
virtual ~ContactElement()
Destructor.
Definition: openrtx_codeplug.cc:672
Implements the codeplug header element.
Definition: openrtx_codeplug.hh:49
virtual unsigned int channelCount() const
Returns the channel count.
Definition: openrtx_codeplug.cc:103
virtual void setChannelCount(unsigned int n)
Sets the channel count.
Definition: openrtx_codeplug.cc:108
void clear()
Abstract method to reset the element within the codeplug.
Definition: openrtx_codeplug.cc:37
bool isValid() const
Returns true if the pointer is not null.
Definition: openrtx_codeplug.cc:45
virtual QString description() const
Returns the description.
Definition: openrtx_codeplug.cc:71
virtual void setZoneCount(unsigned int n)
Sets the zone count.
Definition: openrtx_codeplug.cc:118
HeaderElement(uint8_t *ptr, size_t size)
Hidden constructor.
Definition: openrtx_codeplug.cc:24
virtual unsigned int contactCount() const
Returns the contact count.
Definition: openrtx_codeplug.cc:93
virtual unsigned int zoneCount() const
Returns the zone count.
Definition: openrtx_codeplug.cc:113
virtual QString author() const
Returns the author name.
Definition: openrtx_codeplug.cc:61
virtual void setAuthor(const QString &name)
Sets the author name.
Definition: openrtx_codeplug.cc:66
virtual uint16_t version() const
Returns the version number (MAJOR<<8)|MINOR.
Definition: openrtx_codeplug.cc:50
virtual void setVersion()
Sets the version number.
Definition: openrtx_codeplug.cc:55
virtual void setTimestamp(const QDateTime timestamp=QDateTime::currentDateTime())
Sets the timestamp.
Definition: openrtx_codeplug.cc:87
virtual void setContactCount(unsigned int n)
Sets the contact count.
Definition: openrtx_codeplug.cc:98
virtual void setDescription(const QString description)
Sets the description.
Definition: openrtx_codeplug.cc:76
Offsets
Just holds the offsets within the header and other constants.
Definition: openrtx_codeplug.hh:95
virtual QDateTime timestamp() const
Returns the timestamp.
Definition: openrtx_codeplug.cc:82
The binary encoding of a zone.
Definition: openrtx_codeplug.hh:380
virtual void setName(const QString &name)
Sets the name of the zone.
Definition: openrtx_codeplug.cc:856
Offsets
Just defines the offsets with the element.
Definition: openrtx_codeplug.hh:422
virtual void setChannelCount(unsigned int n)
Sets the number of channels in zone.
Definition: openrtx_codeplug.cc:867
virtual bool linkZoneObj(Zone *zone, Context &ctx, bool putInB, const ErrorStack &err=ErrorStack()) const
Links a previously constructed Zone object to the rest of the configuration.
Definition: openrtx_codeplug.cc:893
virtual void fromZoneObjA(const Zone *zone, Context &ctx)
Resets this codeplug zone representation from the given generic Zone object.
Definition: openrtx_codeplug.cc:909
virtual void fromZoneObjB(const Zone *zone, Context &ctx)
Resets this codeplug zone representation from the given generic Zone object.
Definition: openrtx_codeplug.cc:921
void clear()
Resets the zone.
Definition: openrtx_codeplug.cc:839
virtual void setChannelIndex(unsigned int n, unsigned int idx)
Sets the n-th channel index.
Definition: openrtx_codeplug.cc:879
virtual Zone * toZoneObj(Context &ctx) const
Constructs a generic Zone object from this codeplug zone.
Definition: openrtx_codeplug.cc:885
bool isValid() const
Returns true if the zone is valid.
Definition: openrtx_codeplug.cc:845
virtual unsigned int channelIndex(unsigned int n) const
Returns the n-th channel index.
Definition: openrtx_codeplug.cc:874
virtual unsigned int channelCount() const
Returns the number of channels in zone.
Definition: openrtx_codeplug.cc:862
virtual QString name() const
Returns the zone name.
Definition: openrtx_codeplug.cc:851
ZoneElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition: openrtx_codeplug.cc:822
Implements the binary encoding and decoding of the OpenRTX codeplug.
Definition: openrtx_codeplug.hh:31
virtual void clear()
Clears and resets the complete codeplug to some default values.
Definition: openrtx_codeplug.cc:945
virtual unsigned int numChannels()
Returns the number of stored channels.
Definition: openrtx_codeplug.cc:1108
Offsets
Just stores some sizes.
Definition: openrtx_codeplug.hh:486
virtual unsigned int offsetZoneOffsets()
Returns the offset to the zone offset array.
Definition: openrtx_codeplug.cc:1182
bool encode(Config *config, const Flags &flags=Flags(), const ErrorStack &err=ErrorStack())
Encodes the given generic configuration as a binary codeplug.
Definition: openrtx_codeplug.cc:976
virtual unsigned int offsetContact(unsigned int n)
Returns the offset to the n-th contact element.
Definition: openrtx_codeplug.cc:1064
bool index(Config *config, Context &ctx, const ErrorStack &err=ErrorStack()) const
Indexes all elements of the codeplug.
Definition: openrtx_codeplug.cc:952
virtual bool encodeChannels(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encode all channels.
Definition: openrtx_codeplug.cc:1119
virtual bool createZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds zones to the configuration.
Definition: openrtx_codeplug.cc:1241
OpenRTXCodeplug(QObject *parent=nullptr)
Hidden constructor, use a device specific class to instantiate.
Definition: openrtx_codeplug.cc:933
bool decode(Config *config, const ErrorStack &err=ErrorStack())
Decodes the binary codeplug and stores its content in the given generic configuration.
Definition: openrtx_codeplug.cc:1018
virtual bool linkZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Links all zones within the configuration.
Definition: openrtx_codeplug.cc:1266
Mode
Possible modes for a channel or contact.
Definition: openrtx_codeplug.hh:36
@ Mode_DMR
DMR Channel.
Definition: openrtx_codeplug.hh:39
@ Mode_None
Disabled?
Definition: openrtx_codeplug.hh:37
@ Mode_FM
FM Channel.
Definition: openrtx_codeplug.hh:38
@ Mode_M17
M17 Channel.
Definition: openrtx_codeplug.hh:40
virtual unsigned int offsetChannel(unsigned int n)
Returns the offset to the n-th channel element.
Definition: openrtx_codeplug.cc:1113
virtual bool createContacts(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds a digital contact to the configuration for each one in the codeplug.
Definition: openrtx_codeplug.cc:1090
virtual bool linkChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Links all channels.
Definition: openrtx_codeplug.cc:1159
virtual unsigned int numContacts()
Returns the number of stored contacts.
Definition: openrtx_codeplug.cc:1059
virtual bool decodeElements(Context &ctx, const ErrorStack &err=ErrorStack())
Decodes the binary codeplug and stores its content in the given generic configuration using the given...
Definition: openrtx_codeplug.cc:1029
virtual bool encodeZones(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes zones.
Definition: openrtx_codeplug.cc:1200
virtual bool encodeContacts(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all digital contacts in the configuration into the codeplug.
Definition: openrtx_codeplug.cc:1069
virtual bool encodeElements(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes the given generic configuration as a binary codeplug using the given context.
Definition: openrtx_codeplug.cc:992
virtual ~OpenRTXCodeplug()
Destructor.
Definition: openrtx_codeplug.cc:940
virtual bool createChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds all defined channels to the configuration.
Definition: openrtx_codeplug.cc:1141
virtual unsigned int offsetZone(unsigned int n)
Returns the offset to the n-th zone element.
Definition: openrtx_codeplug.cc:1190
virtual unsigned int numZones()
Returns the number of stored zones.
Definition: openrtx_codeplug.cc:1177
Generic representation of a RX group list.
Definition: rxgrouplist.hh:15
Generic representation of a scan list.
Definition: scanlist.hh:15
Represents a zone within the generic configuration.
Definition: zone.hh:16
Code
This huge enum lists all possible RX/TX tones that can be associated with analog channels.
Definition: signaling.hh:14