libdrmconf 0.12.1
A library to program DMR radios.
Loading...
Searching...
No Matches
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
62class GD77Codeplug: public RadioddityCodeplug
63{
64 Q_OBJECT
65
66public:
71 class ChannelElement: public RadioddityCodeplug::ChannelElement
72 {
73 public:
75 enum ARTSMode {
76 ARTS_OFF = 0,
77 ARTS_TX = 1,
78 ARTS_RX = 2,
79 ARTS_BOTH = 3
80 };
81
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
144 class ContactElement: public RadioddityCodeplug::ContactElement
145 {
146 protected:
148 ContactElement(uint8_t *ptr, unsigned size);
149
150 public:
152 ContactElement(uint8_t *ptr);
153
155 void clear();
156
158 bool isValid() const;
160 virtual void markValid(bool valid=true);
161
162 bool fromContactObj(const DMRContact *obj, Context &ctx, const ErrorStack &err=ErrorStack());
163
164 protected:
166 struct Offset: RadioddityCodeplug::ContactElement::Offset {
168 static constexpr unsigned int validFlag() { return 0x0017; }
170 };
171 };
172
177 class GroupListElement: public RadioddityCodeplug::GroupListElement
178 {
179 protected:
181 GroupListElement(uint8_t *ptr, unsigned size);
182
183 public:
185 GroupListElement(uint8_t *ptr);
186
188 static constexpr unsigned int size() { return 0x0050; }
189
190 virtual bool linkRXGroupListObj(unsigned int ncnt, RXGroupList *lst, Context &ctx, const ErrorStack &err = ErrorStack()) const;
191 virtual bool fromRXGroupListObj(const RXGroupList *lst, Context &ctx, const ErrorStack &err = ErrorStack());
192
193 public:
195 struct Limit: public RadioddityCodeplug::GroupListElement {
196 static constexpr unsigned int memberCount() { return 32; }
197 };
198 };
199
209 class GroupListBankElement: public RadioddityCodeplug::GroupListBankElement
210 {
211 protected:
213 GroupListBankElement(uint8_t *ptr, unsigned size);
214
215 public:
217 GroupListBankElement(uint8_t *ptr);
218
220 static constexpr unsigned int size() { return 0x1480; }
221
222 uint8_t *get(unsigned n) const;
223
224 public:
226 struct Limit: public RadioddityCodeplug::GroupListBankElement::Limit {
227 static constexpr unsigned int groupListCount() { return 64; }
228 };
229 };
230
235 class ScanListElement: public RadioddityCodeplug::ScanListElement
236 {
237 protected:
239 ScanListElement(uint8_t *ptr, unsigned size);
240
241 public:
243 ScanListElement(uint8_t *ptr);
244
246 void clear();
247 };
248
253 class ScanListBankElement: public RadioddityCodeplug::ScanListBankElement
254 {
255 protected:
257 ScanListBankElement(uint8_t *ptr, unsigned size);
258
259 public:
261 ScanListBankElement(uint8_t *ptr);
262
264 static constexpr unsigned int size() { return 0x1640; }
265
267 void clear();
268
269 uint8_t *get(unsigned n) const;
270
271 public:
273 struct Limit: public RadioddityCodeplug::ScanListBankElement::Limit {
274 static constexpr unsigned int scanListCount() { return 64; }
275 };
276
277 protected:
279 struct Offset: public RadioddityCodeplug::ScanListBankElement::Offset {
281 static constexpr unsigned int bytemap() { return 0x0000; }
282 static constexpr unsigned int scanLists() { return 0x0040; }
284 };
285 };
286
287public:
289 explicit GD77Codeplug(QObject *parent=nullptr);
290
291public:
292 void clearGeneralSettings();
293 bool encodeGeneralSettings(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
294 bool decodeGeneralSettings(Context &ctx, const ErrorStack &err=ErrorStack());
295
296 void clearButtonSettings();
297 bool encodeButtonSettings(Context &ctx, const Flags &flags, const ErrorStack &err=ErrorStack());
298 bool decodeButtonSettings(Context &ctx, const ErrorStack &err=ErrorStack());
299
300 void clearMessages();
301 bool encodeMessages(Context &ctx, const Flags &flags, const ErrorStack &err=ErrorStack());
302 bool decodeMessages(Context &ctx, const ErrorStack &err=ErrorStack());
303
304 void clearScanLists();
305 bool encodeScanLists(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
306 bool createScanLists(Context &ctx, const ErrorStack &err=ErrorStack());
307 bool linkScanLists(Context &ctx, const ErrorStack &err=ErrorStack());
308
309 void clearContacts();
310 bool encodeContacts(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
311 bool createContacts(Context &ctx, const ErrorStack &err=ErrorStack());
312
313 void clearDTMFContacts();
314 bool encodeDTMFContacts(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
315 bool createDTMFContacts(Context &ctx, const ErrorStack &err=ErrorStack());
316
317 void clearChannels();
318 bool encodeChannels(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
319 bool createChannels(Context &ctx, const ErrorStack &err=ErrorStack());
320 bool linkChannels(Context &ctx, const ErrorStack &err=ErrorStack());
321
322 void clearBootSettings();
323 void clearMenuSettings();
324
325 void clearBootText();
326 bool encodeBootText(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
327 bool decodeBootText(Context &ctx, const ErrorStack &err=ErrorStack());
328
329 void clearVFOSettings();
330
331 void clearZones();
332 bool encodeZones(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
333 bool createZones(Context &ctx, const ErrorStack &err=ErrorStack());
334 bool linkZones(Context &ctx, const ErrorStack &err=ErrorStack());
335
336 void clearGroupLists();
337 bool encodeGroupLists(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
338 bool createGroupLists(Context &ctx, const ErrorStack &err=ErrorStack());
339 bool linkGroupLists(Context &ctx, const ErrorStack &err=ErrorStack());
340
341 void clearEncryption();
342 bool encodeEncryption(const Flags &flags, Context &ctx, const ErrorStack &err);
343 bool createEncryption(Context &ctx, const ErrorStack &err);
344 bool linkEncryption(Context &ctx, const ErrorStack &err);
345
346public:
348 struct Limit {
349 static constexpr unsigned int dtmfContactCount() { return 32; }
350 static constexpr unsigned int channelBankCount() { return 8; }
351 static constexpr unsigned int channelCount() { return 1024; }
352 static constexpr unsigned int contactCount() { return 1024; }
353 };
354
355protected:
357 struct Offset {
359 static constexpr unsigned int settings() { return 0x0000e0; }
360 static constexpr unsigned int buttons() { return 0x000108; }
361 static constexpr unsigned int messages() { return 0x000128; }
362 static constexpr unsigned int encryption() { return 0x001370; }
363 static constexpr unsigned int scanListBank() { return 0x001790; }
364 static constexpr unsigned int dtmfContacts() { return 0x002f88; }
365 static constexpr unsigned int channelBank0() { return 0x003780; } // Channels 1-128
366 static constexpr unsigned int bootSettings() { return 0x007518; }
367 static constexpr unsigned int bootText() { return 0x007540; }
368 static constexpr unsigned int menuSettings() { return 0x007538; }
369 static constexpr unsigned int vfoA() { return 0x007590; }
370 static constexpr unsigned int vfoB() { return 0x0075c8; }
371 static constexpr unsigned int zoneBank() { return 0x008010; }
372 static constexpr unsigned int channelBank1() { return 0x00b1b0; } // Channels 129-1024
373 static constexpr unsigned int contacts() { return 0x017620; }
374 static constexpr unsigned int groupListBank() { return 0x01d620; }
376 };
377};
378
379#endif // GD77_CODEPLUG_HH
Represents a digital contact, that is a DMR number.
Definition contact.hh:141
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:33
PTTId
PTT ID send.
Definition gd77_codeplug.hh:91
virtual STEAngle steAngle() const
Returns the STE angle.
Definition gd77_codeplug.cc:42
virtual void enableTightSquelch(bool enable)
Enables/disables tight squelch.
Definition gd77_codeplug.cc:64
virtual PTTId pttIDMode() const
Returns the PTT ID mode.
Definition gd77_codeplug.cc:51
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:46
virtual void enableLoneWorker(bool enable)
Enables/disables lone worker.
Definition gd77_codeplug.cc:73
virtual void setPTTIDMode(PTTId mode)
Sets the PTT ID mode.
Definition gd77_codeplug.cc:55
ARTSMode
ARTS send.
Definition gd77_codeplug.hh:75
virtual bool squelchIsTight() const
Returns true if the squech type is tight.
Definition gd77_codeplug.cc:60
ChannelElement(uint8_t *ptr, size_t size)
Hidden Constructor.
Definition gd77_codeplug.cc:12
virtual bool loneWorker() const
Returns true if lone worker is enabled.
Definition gd77_codeplug.cc:69
virtual void setARTSMode(ARTSMode mode)
Sets the ARTS mode.
Definition gd77_codeplug.cc:37
virtual void enableAutoscan(bool enable)
Enables/disables auto scan.
Definition gd77_codeplug.cc:82
virtual bool autoscan() const
Returns true if auto scan is enabled.
Definition gd77_codeplug.cc:78
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:108
virtual void markValid(bool valid=true)
Marks the entry as valid/invalid.
Definition gd77_codeplug.cc:113
ContactElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition gd77_codeplug.cc:90
void clear()
Resets the contact.
Definition gd77_codeplug.cc:103
Table of RX group lists.
Definition gd77_codeplug.hh:210
GroupListBankElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition gd77_codeplug.cc:233
static constexpr unsigned int size()
The size of the group list bank.
Definition gd77_codeplug.hh:220
Represents an RX group list within the codeplug.
Definition gd77_codeplug.hh:178
static constexpr unsigned int size()
The size of the element.
Definition gd77_codeplug.hh:188
GroupListElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition gd77_codeplug.cc:176
Bank of scan lists for the GD77.
Definition gd77_codeplug.hh:254
ScanListBankElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition gd77_codeplug.cc:150
static constexpr unsigned int size()
The size of the scan list bank.
Definition gd77_codeplug.hh:264
void clear()
Clears the scan list bank.
Definition gd77_codeplug.cc:163
Represents a single scan list within the GD77 codeplug.
Definition gd77_codeplug.hh:236
void clear()
Resets the scan list.
Definition gd77_codeplug.cc:141
ScanListElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition gd77_codeplug.cc:128
Represents, encodes and decodes the device specific codeplug for a Radioddity GD-77.
Definition gd77_codeplug.hh:63
GD77Codeplug(QObject *parent=nullptr)
Constructs an empty codeplug for the GD-77.
Definition gd77_codeplug.cc:258
Generic representation of a RX group list.
Definition rxgrouplist.hh:14
Some internal offsets.
Definition gd77_codeplug.hh:166
Some limits for the group list bank.
Definition gd77_codeplug.hh:226
static constexpr unsigned int groupListCount()
Number of group lists.
Definition gd77_codeplug.hh:227
Some limits for the group list.
Definition gd77_codeplug.hh:195
static constexpr unsigned int memberCount()
Maximum number of entries.
Definition gd77_codeplug.hh:196
Some limits for the GD77 codeplug.
Definition gd77_codeplug.hh:348
static constexpr unsigned int channelCount()
Maximum number of channels.
Definition gd77_codeplug.hh:351
static constexpr unsigned int contactCount()
Maximum number of contacts.
Definition gd77_codeplug.hh:352
static constexpr unsigned int channelBankCount()
Number of channel banks.
Definition gd77_codeplug.hh:350
static constexpr unsigned int dtmfContactCount()
Maximum number of DTMF contacts.
Definition gd77_codeplug.hh:349
Some internal offsets within the codeplug.
Definition gd77_codeplug.hh:357
Some limits for the scan list bank.
Definition gd77_codeplug.hh:273
static constexpr unsigned int scanListCount()
Maximum number of scan lists.
Definition gd77_codeplug.hh:274
Internal offsets within the element.
Definition gd77_codeplug.hh:279