libdrmconf  0.11.0
A library to program DMR radios.
gd77_codeplug.hh
1 #ifndef GD77_CODEPLUG_HH
2 #define GD77_CODEPLUG_HH
3 
4 #include "radioddity_codeplug.hh"
5 #include "signaling.hh"
6 
7 
63 {
64  Q_OBJECT
65 
66 public:
72  {
73  public:
75  enum ARTSMode {
76  ARTS_OFF = 0,
77  ARTS_TX = 1,
78  ARTS_RX = 2,
79  ARTS_BOTH = 3
80  };
81 
83  enum STEAngle {
85  STE_120DEG = 1,
86  STE_180DEG = 2,
87  STE_240DEG = 3
88  };
89 
91  enum PTTId {
92  PTTID_OFF = 0,
93  PTTID_START = 1,
94  PTTID_END = 2,
95  PTTID_BOTH = 3
96  };
97 
98  protected:
100  ChannelElement(uint8_t *ptr, size_t size);
101 
102  public:
104  explicit ChannelElement(uint8_t *ptr);
105 
106  void clear();
107 
109  virtual ARTSMode artsMode() const;
111  virtual void setARTSMode(ARTSMode mode);
112 
114  virtual STEAngle steAngle() const;
116  virtual void setSTEAngle(STEAngle angle);
117 
119  virtual PTTId pttIDMode() const;
121  virtual void setPTTIDMode(PTTId mode);
122 
124  virtual bool squelchIsTight() const;
126  virtual void enableTightSquelch(bool enable);
127 
129  virtual bool loneWorker() const;
131  virtual void enableLoneWorker(bool enable);
132 
134  virtual bool autoscan() const;
136  virtual void enableAutoscan(bool enable);
137  };
138 
145  {
146  protected:
148  ContactElement(uint8_t *ptr, unsigned size);
149 
150  public:
152  ContactElement(uint8_t *ptr);
153 
155  void clear();
157  bool isValid() const;
158 
160  virtual void markValid(bool valid=true);
161  void fromContactObj(const DMRContact *obj, Context &ctx);
162  };
163 
169  {
170  protected:
172  GroupListElement(uint8_t *ptr, unsigned size);
173 
174  public:
176  GroupListElement(uint8_t *ptr);
177  };
178 
189  {
190  protected:
192  GroupListBankElement(uint8_t *ptr, unsigned size);
193 
194  public:
196  GroupListBankElement(uint8_t *ptr);
197 
198  uint8_t *get(unsigned n) const;
199  };
200 
206  {
207  protected:
209  ScanListElement(uint8_t *ptr, unsigned size);
210 
211  public:
213  ScanListElement(uint8_t *ptr);
214 
216  void clear();
217  };
218 
224  {
225  protected:
227  ScanListBankElement(uint8_t *ptr, unsigned size);
228 
229  public:
231  ScanListBankElement(uint8_t *ptr);
232 
234  void clear();
235  uint8_t *get(unsigned n) const;
236  };
237 
238 public:
240  explicit GD77Codeplug(QObject *parent=nullptr);
241 
242 public:
243  void clearGeneralSettings();
244  bool encodeGeneralSettings(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
245  bool decodeGeneralSettings(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
246 
247  void clearButtonSettings();
248  void clearMessages();
249 
250  void clearScanLists();
251  bool encodeScanLists(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
252  bool createScanLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
253  bool linkScanLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
254 
255  void clearContacts();
256  bool encodeContacts(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
257  bool createContacts(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
258 
259  void clearDTMFContacts();
260  bool encodeDTMFContacts(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
261  bool createDTMFContacts(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
262 
263  void clearChannels();
264  bool encodeChannels(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
265  bool createChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
266  bool linkChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
267 
268  void clearBootSettings();
269  void clearMenuSettings();
270 
271  void clearBootText();
272  bool encodeBootText(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
273  bool decodeBootText(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
274 
275  void clearVFOSettings();
276 
277  void clearZones();
278  bool encodeZones(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
279  bool createZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
280  bool linkZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
281 
282  void clearGroupLists();
283  bool encodeGroupLists(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
284  bool createGroupLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
285  bool linkGroupLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
286 
287  void clearEncryption();
288  bool encodeEncryption(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err);
289  bool createEncryption(Config *config, Context &ctx, const ErrorStack &err);
290  bool linkEncryption(Config *config, Context &ctx, const ErrorStack &err);
291 };
292 
293 #endif // GD77_CODEPLUG_HH
Base class for all codeplug contexts.
Definition: codeplug.hh:195
Certain flags passed to CodePlug::encode to control the transfer and encoding of the codeplug.
Definition: codeplug.hh:24
The config class, representing the codeplug configuration.
Definition: config.hh:68
uint32_t size() const
Returns the total size of the DFU file.
Definition: dfufile.cc:50
Represents a digital contact, that is a DMR number.
Definition: contact.hh:140
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Channel representation within the binary codeplug.
Definition: gd77_codeplug.hh:72
virtual ARTSMode artsMode() const
Returns the ARTS mode.
Definition: gd77_codeplug.cc:75
PTTId
PTT ID send.
Definition: gd77_codeplug.hh:91
virtual STEAngle steAngle() const
Returns the STE angle.
Definition: gd77_codeplug.cc:84
virtual void enableTightSquelch(bool enable)
Enables/disables tight squelch.
Definition: gd77_codeplug.cc:106
virtual PTTId pttIDMode() const
Returns the PTT ID mode.
Definition: gd77_codeplug.cc:93
STEAngle
STE angle.
Definition: gd77_codeplug.hh:83
@ STE_180DEG
180 degree.
Definition: gd77_codeplug.hh:86
@ STE_120DEG
120 degree.
Definition: gd77_codeplug.hh:85
@ STE_240DEG
240 degree.
Definition: gd77_codeplug.hh:87
@ STE_FREQUENCY
STE Frequency.
Definition: gd77_codeplug.hh:84
virtual void setSTEAngle(STEAngle angle)
Sets the STE angle.
Definition: gd77_codeplug.cc:88
virtual void enableLoneWorker(bool enable)
Enables/disables lone worker.
Definition: gd77_codeplug.cc:115
virtual void setPTTIDMode(PTTId mode)
Sets the PTT ID mode.
Definition: gd77_codeplug.cc:97
ARTSMode
ARTS send.
Definition: gd77_codeplug.hh:75
virtual bool squelchIsTight() const
Returns true if the squech type is tight.
Definition: gd77_codeplug.cc:102
void clear()
Resets the channel.
Definition: gd77_codeplug.cc:67
ChannelElement(uint8_t *ptr, size_t size)
Hidden Constructor.
Definition: gd77_codeplug.cc:54
virtual bool loneWorker() const
Returns true if lone worker is enabled.
Definition: gd77_codeplug.cc:111
virtual void setARTSMode(ARTSMode mode)
Sets the ARTS mode.
Definition: gd77_codeplug.cc:79
virtual void enableAutoscan(bool enable)
Enables/disables auto scan.
Definition: gd77_codeplug.cc:124
virtual bool autoscan() const
Returns true if auto scan is enabled.
Definition: gd77_codeplug.cc:120
Specific codeplug representation of a DMR contact for the GD77.
Definition: gd77_codeplug.hh:145
bool isValid() const
Returns true if the contact is valid.
Definition: gd77_codeplug.cc:150
void fromContactObj(const DMRContact *obj, Context &ctx)
Resets this codeplug contact from the given DigitalContact.
Definition: gd77_codeplug.cc:162
virtual void markValid(bool valid=true)
Marks the entry as valid/invalid.
Definition: gd77_codeplug.cc:155
ContactElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition: gd77_codeplug.cc:132
void clear()
Resets the contact.
Definition: gd77_codeplug.cc:145
Table of RX group lists.
Definition: gd77_codeplug.hh:189
uint8_t * get(unsigned n) const
Returns a pointer to the n-th group list.
Definition: gd77_codeplug.cc:248
GroupListBankElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition: gd77_codeplug.cc:235
Represents an RX group list within the codeplug.
Definition: gd77_codeplug.hh:169
GroupListElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition: gd77_codeplug.cc:219
Bank of scan lists for the GD77.
Definition: gd77_codeplug.hh:224
ScanListBankElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition: gd77_codeplug.cc:193
uint8_t * get(unsigned n) const
Returns a pointer to the n-th scan list.
Definition: gd77_codeplug.cc:211
void clear()
Clears the scan list bank.
Definition: gd77_codeplug.cc:206
Represents a single scan list within the GD77 codeplug.
Definition: gd77_codeplug.hh:206
void clear()
Resets the scan list.
Definition: gd77_codeplug.cc:184
ScanListElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition: gd77_codeplug.cc:171
Represents, encodes and decodes the device specific codeplug for a Radioddity GD-77.
Definition: gd77_codeplug.hh:63
bool encodeGroupLists(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all group lists.
Definition: gd77_codeplug.cc:652
bool decodeGeneralSettings(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Updates the given configuration from the general settings.
Definition: gd77_codeplug.cc:280
bool encodeScanLists(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all scan lists.
Definition: gd77_codeplug.cc:303
bool createGroupLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Creates all group lists.
Definition: gd77_codeplug.cc:667
void clearContacts()
Clears all contacts in the codeplug.
Definition: gd77_codeplug.cc:574
bool createContacts(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds a digital contact to the configuration for each one in the codeplug.
Definition: gd77_codeplug.cc:594
bool encodeBootText(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes boot text.
Definition: gd77_codeplug.cc:438
void clearMessages()
Clears the messages.
Definition: gd77_codeplug.cc:291
bool encodeGeneralSettings(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Updates the general settings from the given configuration.
Definition: gd77_codeplug.cc:270
void clearEncryption()
Clears all encryption keys.
Definition: gd77_codeplug.cc:702
bool linkZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Links all zones within the configuration.
Definition: gd77_codeplug.cc:539
bool encodeDTMFContacts(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all DTMF contacts.
Definition: gd77_codeplug.cc:616
void clearMenuSettings()
Clears menu settings.
Definition: gd77_codeplug.cc:428
bool linkScanLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Links all scan lists.
Definition: gd77_codeplug.cc:333
void clearBootText()
Clears boot text.
Definition: gd77_codeplug.cc:433
void clearChannels()
Clear all channels.
Definition: gd77_codeplug.cc:347
bool createScanLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Creates all scan lists.
Definition: gd77_codeplug.cc:318
void clearScanLists()
Clears all scan lists.
Definition: gd77_codeplug.cc:296
void clearBootSettings()
Clear boot settings.
Definition: gd77_codeplug.cc:423
void clearDTMFContacts()
Clears all DTMF contacts in the codeplug.
Definition: gd77_codeplug.cc:610
bool encodeEncryption(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err)
Encodes all encryption keys defined.
Definition: gd77_codeplug.cc:708
bool createZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds zones to the configuration.
Definition: gd77_codeplug.cc:504
GD77Codeplug(QObject *parent=nullptr)
Constructs an empty codeplug for the GD-77.
Definition: gd77_codeplug.cc:256
bool encodeContacts(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all digital contacts in the configuration into the codeplug.
Definition: gd77_codeplug.cc:580
bool linkGroupLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Links all group lists.
Definition: gd77_codeplug.cc:682
bool encodeZones(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes zones.
Definition: gd77_codeplug.cc:467
void clearGroupLists()
Clears all group lists.
Definition: gd77_codeplug.cc:645
bool encodeChannels(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encode all channels.
Definition: gd77_codeplug.cc:359
bool linkEncryption(Config *config, Context &ctx, const ErrorStack &err)
Links all encryption keys.
Definition: gd77_codeplug.cc:725
void clearZones()
Clears all zones.
Definition: gd77_codeplug.cc:459
void clearButtonSettings()
Clears the button settings.
Definition: gd77_codeplug.cc:286
bool createDTMFContacts(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds all DTMF contacts to the configuration.
Definition: gd77_codeplug.cc:630
bool decodeBootText(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Updates the given configuration from the boot text settings.
Definition: gd77_codeplug.cc:446
bool createEncryption(Config *config, Context &ctx, const ErrorStack &err)
Creates all encryption keys.
Definition: gd77_codeplug.cc:716
void clearGeneralSettings()
Clears the general settings in the codeplug.
Definition: gd77_codeplug.cc:265
bool linkChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Links all channels.
Definition: gd77_codeplug.cc:404
bool createChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds all defined channels to the configuration.
Definition: gd77_codeplug.cc:385
void clearVFOSettings()
Clears the VFO settings.
Definition: gd77_codeplug.cc:453
Implements the base for all Radioddity channel encodings.
Definition: radioddity_codeplug.hh:31
virtual Mode mode() const
Returns the channel mode.
Definition: radioddity_codeplug.cc:87
Implements the base for digital contacts in Radioddity codeplugs.
Definition: radioddity_codeplug.hh:310
Implements a base class of group list memory banks for all Radioddity codeplugs.
Definition: radioddity_codeplug.hh:519
Represents a base class for all group lists within Radioddity codeplugs.
Definition: radioddity_codeplug.hh:476
Implements the base class of scan lists banks for all Radioddity codeplugs.
Definition: radioddity_codeplug.hh:673
Implements the base class for scan lists of all Radioddity codeplugs.
Definition: radioddity_codeplug.hh:553
Base class of all Radioddity codeplugs.
Definition: radioddity_codeplug.hh:22