libdrmconf 0.15.0
A library to program DMR radios.
Loading...
Searching...
No Matches
dm1701_codeplug.hh
1#ifndef DM1701_CODEPLUG_HH
2#define DM1701_CODEPLUG_HH
3
4#include "tyt_codeplug.hh"
5
49{
50 Q_OBJECT
51
52public:
58 {
59 protected:
61 ChannelElement(uint8_t *ptr, size_t size);
62
63 public:
65 explicit ChannelElement(uint8_t *ptr);
66
67 void clear();
68
70 virtual bool tightSquelchEnabled() const;
72 virtual void enableTightSquelch(bool enable);
73
75 virtual bool reverseBurst() const;
77 virtual void enableReverseBurst(bool enable);
78
80 virtual Channel::Power power() const;
82 virtual void setPower(Channel::Power pwr);
83
85 Channel *toChannelObj(const ErrorStack &err=ErrorStack()) const;
87 void fromChannelObj(const Channel *c, Context &ctx);
88 };
89
95 {
96 protected:
98 VFOChannelElement(uint8_t *ptr, size_t size);
99
100 public:
102 VFOChannelElement(uint8_t *ptr);
104 virtual ~VFOChannelElement();
105
106 QString name() const;
107 void setName(const QString &txt);
108
110 virtual unsigned stepSize() const;
112 virtual void setStepSize(unsigned ss_hz);
113 };
114
121 {
122 protected:
124 GeneralSettingsElement(uint8_t *ptr, size_t size);
125
126 public:
128 GeneralSettingsElement(uint8_t *ptr);
129
130 void clear();
131
133 virtual bool channelModeA() const;
135 virtual void enableChannelModeA(bool enable);
137 virtual bool channelModeB() const;
139 virtual void enableChannelModeB(bool enable);
140
142 virtual bool channelMode() const;
144 virtual void enableChannelMode(bool enable);
145
147 virtual bool groupCallMatch() const;
149 virtual void enableGroupCallMatch(bool enable);
151 virtual bool privateCallMatch() const;
153 virtual void enablePrivateCallMatch(bool enable);
154
156 virtual QTimeZone timeZone() const;
158 virtual void setTimeZone(const QTimeZone &zone);
159
161 virtual unsigned channelHangTime() const;
163 virtual void setChannelHangTime(unsigned dur);
164
166 virtual bool fromConfig(const Config *config);
168 virtual bool updateConfig(Config *config);
169 };
170
177 {
178 protected:
180 ButtonSettingsElement(uint8_t *ptr, size_t size);
181
182 public:
184 explicit ButtonSettingsElement(uint8_t *ptr);
185
186 void clear();
187
189 virtual ButtonAction sideButton3Short() const;
191 virtual void setSideButton3Short(ButtonAction action);
193 virtual ButtonAction sideButton3Long() const;
195 virtual void setSideButton3Long(ButtonAction action);
196
198 virtual ButtonAction progButton1Short() const;
200 virtual void setProgButton1Short(ButtonAction action);
202 virtual ButtonAction progButton1Long() const;
204 virtual void setProgButton1Long(ButtonAction action);
205
207 virtual ButtonAction progButton2Short() const;
209 virtual void setProgButton2Short(ButtonAction action);
211 virtual ButtonAction progButton2Long() const;
213 virtual void setProgButton2Long(ButtonAction action);
214
216 virtual bool fromConfig(const Config *config);
218 virtual bool updateConfig(Config *config);
219 };
220
228 {
229 protected:
231 ZoneExtElement(uint8_t *ptr, size_t size);
232
233 public:
235 ZoneExtElement(uint8_t *ptr);
237 virtual ~ZoneExtElement();
238
239 void clear();
240
242 virtual bool hasMemberIndexA(unsigned n) const;
244 virtual uint16_t memberIndexA(unsigned n) const;
246 virtual void setMemberIndexA(unsigned n, uint16_t idx);
248 virtual bool hasMemberIndexB(unsigned n) const;
250 virtual uint16_t memberIndexB(unsigned n) const;
252 virtual void setMemberIndexB(unsigned n, uint16_t idx);
253
255 virtual bool fromZoneObj(const Zone *zone, Context &ctx);
258 virtual bool linkZoneObj(Zone *zone, Context &ctx);
259 };
260
261public:
263 explicit DM1701Codeplug(QObject *parent = nullptr);
265 virtual ~DM1701Codeplug();
266
267public:
268 void clearTimestamp();
269 bool encodeTimestamp();
270
272 bool encodeGeneralSettings(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
273 bool decodeGeneralSettings(Context &ctx, const ErrorStack &err=ErrorStack());
274
275 void clearChannels();
276 bool encodeChannels(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
277 bool createChannels(Context &ctx, const ErrorStack &err=ErrorStack());
278 bool linkChannels(Context &ctx, const ErrorStack &err=ErrorStack());
279
280 void clearContacts();
281 bool encodeContacts(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
282 bool createContacts(Context &ctx, const ErrorStack &err=ErrorStack());
283
284 void clearZones();
285 bool encodeZones(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
286 bool createZones(Context &ctx, const ErrorStack &err=ErrorStack());
287 bool linkZones(Context &ctx, const ErrorStack &err=ErrorStack());
288
289 void clearGroupLists();
290 bool encodeGroupLists(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
291 bool createGroupLists(Context &ctx, const ErrorStack &err=ErrorStack());
292 bool linkGroupLists(Context &ctx, const ErrorStack &err=ErrorStack());
293
294 void clearScanLists();
295 bool encodeScanLists(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
296 bool createScanLists(Context &ctx, const ErrorStack &err=ErrorStack());
297 bool linkScanLists(Context &ctx, const ErrorStack &err=ErrorStack());
298
299 void clearButtonSettings();
300 bool encodeButtonSettings(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
301 bool decodeButtonSetttings(Context &ctx, const ErrorStack &err=ErrorStack());
302
304 bool encodePositioningSystems(const Flags &flags, Context &ctx, const ErrorStack &err);
305 bool createPositioningSystems(Context &ctx, const ErrorStack &err);
306 bool linkPositioningSystems(Context &ctx, const ErrorStack &err);
307
308 void clearPrivacyKeys();
309 bool encodePrivacyKeys(const Flags &flags, Context &ctx, const ErrorStack &err);
310 bool decodePrivacyKeys(Context &ctx, const ErrorStack &err);
311
312 void clearTextMessages();
313 bool encodeTextMessages(Context &ctx, const Flags &flags, const ErrorStack &err);
314 bool decodeTextMessages(Context &ctx, const ErrorStack &err);
315
316 void clearMenuSettings();
319 virtual void clearVFOSettings();
320
321protected:
323 struct Offset {
325 static constexpr unsigned int messages() { return 0x002180; }
327 };
328};
329
330#endif // DM1701_CODEPLUG_HH
The base class of all channels (analog and digital) of a codeplug configuration.
Definition channel.hh:38
Power
Specifies the prefix for every ID assigned to every channel during serialization.
Definition channel.hh:65
Base class for all codeplug contexts.
Definition codeplug.hh:331
Represents the abstract base class of all codeplug elements.
Definition codeplug.hh:65
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:70
uint32_t size() const
Returns the total size of the DFU file.
Definition dfufile.cc:52
virtual ButtonAction progButton2Short() const
Returns the action for a short press on programmable button 2.
Definition dm1701_codeplug.cc:386
virtual ButtonAction progButton1Short() const
Returns the action for a short press on programmable button 1.
Definition dm1701_codeplug.cc:368
virtual void setSideButton3Short(ButtonAction action)
Sets the action for a short press on side button 3.
Definition dm1701_codeplug.cc:354
virtual ButtonAction sideButton3Short() const
Returns the action for a short press on side button 3.
Definition dm1701_codeplug.cc:350
virtual void setProgButton2Long(ButtonAction action)
Sets the action for a long press on programmable button 2.
Definition dm1701_codeplug.cc:399
ButtonSettingsElement(uint8_t *ptr, size_t size)
Hidden constructor.
Definition dm1701_codeplug.cc:327
virtual bool updateConfig(Config *config)
Updates config from button settings.
Definition dm1701_codeplug.cc:422
virtual bool fromConfig(const Config *config)
Encodes the button settings.
Definition dm1701_codeplug.cc:404
virtual void setProgButton2Short(ButtonAction action)
Sets the action for a short press on programmable button 2.
Definition dm1701_codeplug.cc:390
virtual ButtonAction progButton2Long() const
Returns the action for a long press on programmable button 2.
Definition dm1701_codeplug.cc:395
virtual ButtonAction sideButton3Long() const
Returns the action for a long press on side button 3.
Definition dm1701_codeplug.cc:359
virtual void setProgButton1Long(ButtonAction action)
Sets the action for a long press on programmable button 1.
Definition dm1701_codeplug.cc:381
virtual void setSideButton3Long(ButtonAction action)
Sets the action for a long press on side button 3.
Definition dm1701_codeplug.cc:363
virtual void setProgButton1Short(ButtonAction action)
Sets the action for a short press on programmable button 1.
Definition dm1701_codeplug.cc:372
virtual ButtonAction progButton1Long() const
Returns the action for a long press on programmable button 1.
Definition dm1701_codeplug.cc:377
void clear()
Abstract method to reset the element within the codeplug.
Definition dm1701_codeplug.cc:340
void clear()
Abstract method to reset the element within the codeplug.
Definition dm1701_codeplug.cc:68
virtual void setPower(Channel::Power pwr)
Sets the power of this channel.
Definition dm1701_codeplug.cc:104
Channel * toChannelObj(const ErrorStack &err=ErrorStack()) const
Constructs a generic Channel object from the codeplug channel.
Definition dm1701_codeplug.cc:118
virtual void enableReverseBurst(bool enable)
Enables/disables reverse burst.
Definition dm1701_codeplug.cc:93
virtual Channel::Power power() const
Returns the power of this channel.
Definition dm1701_codeplug.cc:98
virtual void enableTightSquelch(bool enable)
Enables/disables tight squelch.
Definition dm1701_codeplug.cc:84
virtual bool tightSquelchEnabled() const
Returns true if the squelch is 'tight'.
Definition dm1701_codeplug.cc:80
void fromChannelObj(const Channel *c, Context &ctx)
Initializes this codeplug channel from the given generic configuration.
Definition dm1701_codeplug.cc:136
ChannelElement(uint8_t *ptr, size_t size)
Hidden constructor.
Definition dm1701_codeplug.cc:55
virtual bool reverseBurst() const
Returns true if the reversed burst is enabled.
Definition dm1701_codeplug.cc:89
virtual bool channelMode() const
Returns true, if the radio is in channel (and not VFO) mode.
Definition dm1701_codeplug.cc:240
virtual bool fromConfig(const Config *config)
Encodes the general settings.
Definition dm1701_codeplug.cc:285
GeneralSettingsElement(uint8_t *ptr, size_t size)
Hidden constructor.
Definition dm1701_codeplug.cc:194
virtual void enablePrivateCallMatch(bool enable)
Enables/disables private-call match.
Definition dm1701_codeplug.cc:261
virtual bool groupCallMatch() const
Returns true if group-call match is enabled.
Definition dm1701_codeplug.cc:249
void clear()
Abstract method to reset the element within the codeplug.
Definition dm1701_codeplug.cc:207
virtual void setTimeZone(const QTimeZone &zone)
Sets the time-zone.
Definition dm1701_codeplug.cc:270
virtual bool channelModeB() const
Returns true, if VFO B is in channel mode.
Definition dm1701_codeplug.cc:231
virtual bool privateCallMatch() const
Returns true if private-call match is enabled.
Definition dm1701_codeplug.cc:257
virtual void enableChannelModeA(bool enable)
Enables/disables the channel mode for VFO A.
Definition dm1701_codeplug.cc:226
virtual void enableChannelModeB(bool enable)
Enables/disables the channel mode for VFO B.
Definition dm1701_codeplug.cc:235
virtual bool channelModeA() const
Returns true, if VFO A is in channel mode.
Definition dm1701_codeplug.cc:222
virtual unsigned channelHangTime() const
Returns the channel hang time in ms.
Definition dm1701_codeplug.cc:276
virtual void setChannelHangTime(unsigned dur)
Sets the channel hang time in ms.
Definition dm1701_codeplug.cc:280
virtual bool updateConfig(Config *config)
Updates config from general settings.
Definition dm1701_codeplug.cc:306
virtual void enableChannelMode(bool enable)
Enable/disable channel mode.
Definition dm1701_codeplug.cc:244
virtual QTimeZone timeZone() const
Returns the time-zone.
Definition dm1701_codeplug.cc:266
virtual void enableGroupCallMatch(bool enable)
Enables/disables group-call match.
Definition dm1701_codeplug.cc:253
virtual void setStepSize(unsigned ss_hz)
Sets the step-size for the VFO channel in Hz.
Definition dm1701_codeplug.cc:184
QString name() const
Returns the name of this channel.
Definition dm1701_codeplug.cc:170
VFOChannelElement(uint8_t *ptr, size_t size)
Constructor from pointer to memory.
Definition dm1701_codeplug.cc:153
void setName(const QString &txt)
Sets the name of this channel.
Definition dm1701_codeplug.cc:174
virtual ~VFOChannelElement()
Destructor.
Definition dm1701_codeplug.cc:165
virtual unsigned stepSize() const
Returns the step-size for the VFO channel.
Definition dm1701_codeplug.cc:180
virtual bool hasMemberIndexB(unsigned n) const
Returns true if the n-th member index for list B is set.
Definition dm1701_codeplug.cc:479
virtual void setMemberIndexB(unsigned n, uint16_t idx)
Returns the n-th member index of the channel list for B.
Definition dm1701_codeplug.cc:488
virtual uint16_t memberIndexA(unsigned n) const
Returns the n-th member index of the channel list for A.
Definition dm1701_codeplug.cc:469
virtual bool linkZoneObj(Zone *zone, Context &ctx)
Links the given zone object.
Definition dm1701_codeplug.cc:514
virtual ~ZoneExtElement()
Destructor.
Definition dm1701_codeplug.cc:455
virtual bool fromZoneObj(const Zone *zone, Context &ctx)
Encodes the given zone.
Definition dm1701_codeplug.cc:493
virtual uint16_t memberIndexB(unsigned n) const
Returns the n-th member index of the channel list for B.
Definition dm1701_codeplug.cc:483
virtual void setMemberIndexA(unsigned n, uint16_t idx)
Sets the n-th member index of the channel list for A.
Definition dm1701_codeplug.cc:474
virtual bool hasMemberIndexA(unsigned n) const
Returns true if the n-th member index for list A is set.
Definition dm1701_codeplug.cc:465
ZoneExtElement(uint8_t *ptr, size_t size)
Constructor.
Definition dm1701_codeplug.cc:443
void clear()
Abstract method to reset the element within the codeplug.
Definition dm1701_codeplug.cc:460
void clearContacts()
Clears all contacts in the codeplug.
Definition dm1701_codeplug.cc:635
bool encodeScanLists(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all scan lists in the configuration into the codeplug.
Definition dm1701_codeplug.cc:791
bool linkScanLists(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added scan lists within the configuration.
Definition dm1701_codeplug.cc:821
bool createPositioningSystems(Context &ctx, const ErrorStack &err)
Adds a GPS positioning system to the configuration for each one in the codeplug.
Definition dm1701_codeplug.cc:930
bool decodeTextMessages(Context &ctx, const ErrorStack &err)
Decodes text messages.
Definition dm1701_codeplug.cc:898
void clearMenuSettings()
Clears the menu settings in the codeplug.
Definition dm1701_codeplug.cc:836
bool encodeContacts(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all digital contacts in the configuration into the codeplug.
Definition dm1701_codeplug.cc:642
void clearChannels()
Clears all channels in the codeplug.
Definition dm1701_codeplug.cc:583
bool createScanLists(Context &ctx, const ErrorStack &err=ErrorStack())
Adds a scan list to the configuration for each one in the codeplug.
Definition dm1701_codeplug.cc:805
void clearScanLists()
Clears all scan lists in the codeplug.
Definition dm1701_codeplug.cc:784
void clearTimestamp()
Clears the time-stamp in the codeplug.
Definition dm1701_codeplug.cc:554
bool createContacts(Context &ctx, const ErrorStack &err=ErrorStack())
Adds a digital contact to the configuration for each one in the codeplug.
Definition dm1701_codeplug.cc:656
void clearTextMessages()
Clears all text messages in the codeplug.
Definition dm1701_codeplug.cc:888
void clearPositioningSystems()
Clears all positioning systems in the codeplug.
Definition dm1701_codeplug.cc:918
bool encodeGeneralSettings(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Updates the general settings from the given configuration.
Definition dm1701_codeplug.cc:571
bool createChannels(Context &ctx, const ErrorStack &err=ErrorStack())
Adds a channel to the configuration for each one in the codeplug.
Definition dm1701_codeplug.cc:605
bool createZones(Context &ctx, const ErrorStack &err=ErrorStack())
Adds a zone to the configuration for each one in the codeplug.
Definition dm1701_codeplug.cc:698
bool linkPositioningSystems(Context &ctx, const ErrorStack &err)
Links all added positioning systems within the configuration.
Definition dm1701_codeplug.cc:937
virtual ~DM1701Codeplug()
Destructor.
Definition dm1701_codeplug.cc:549
bool decodePrivacyKeys(Context &ctx, const ErrorStack &err)
Decodes the encryption keys.
Definition dm1701_codeplug.cc:875
void clearGroupLists()
Clears all RX group lists in the codeplug.
Definition dm1701_codeplug.cc:735
virtual void clearVFOSettings()
Resets VFO settings.
Definition dm1701_codeplug.cc:911
bool encodeZones(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all zones in the configuration into the codeplug.
Definition dm1701_codeplug.cc:681
bool createGroupLists(Context &ctx, const ErrorStack &err=ErrorStack())
Adds a RX group list to the configuration for each one in the codeplug.
Definition dm1701_codeplug.cc:754
bool encodeGroupLists(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all group lists in the configuration into the codeplug.
Definition dm1701_codeplug.cc:741
bool linkChannels(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added channels within the configuration.
Definition dm1701_codeplug.cc:621
bool encodeTextMessages(Context &ctx, const Flags &flags, const ErrorStack &err)
Encodes text messages.
Definition dm1701_codeplug.cc:893
bool encodePositioningSystems(const Flags &flags, Context &ctx, const ErrorStack &err)
Encodes all DMR positioning systems in the configuration into the codeplug.
Definition dm1701_codeplug.cc:923
bool linkGroupLists(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added RX group lists within the configuration.
Definition dm1701_codeplug.cc:770
bool encodeTimestamp()
Sets the time-stamp.
Definition dm1701_codeplug.cc:559
void clearZones()
Clears all zones in the codeplug.
Definition dm1701_codeplug.cc:672
void clearPrivacyKeys()
Clears all encryption keys in the codeplug.
Definition dm1701_codeplug.cc:860
void clearButtonSettings()
Clears the button settings in the codeplug.
Definition dm1701_codeplug.cc:841
void clearEmergencySystems()
Clears all emergency systems in the codeplug.
Definition dm1701_codeplug.cc:904
bool encodeButtonSettings(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes the button settings.
Definition dm1701_codeplug.cc:846
void clearGeneralSettings()
Clears the general settings in the codeplug.
Definition dm1701_codeplug.cc:566
bool encodePrivacyKeys(const Flags &flags, Context &ctx, const ErrorStack &err)
Encodes the encryption keys.
Definition dm1701_codeplug.cc:865
DM1701Codeplug(QObject *parent=nullptr)
Constructor.
Definition dm1701_codeplug.cc:538
bool linkZones(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added zones within the configuration.
Definition dm1701_codeplug.cc:715
bool decodeGeneralSettings(Context &ctx, const ErrorStack &err=ErrorStack())
Updates the given configuration from the general settings.
Definition dm1701_codeplug.cc:577
bool decodeButtonSetttings(Context &ctx, const ErrorStack &err=ErrorStack())
Decodes the button settings.
Definition dm1701_codeplug.cc:853
bool encodeChannels(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all channels in the configuration into the codeplug.
Definition dm1701_codeplug.cc:590
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:43
Represents all button settings within the codeplug on the radio.
Definition tyt_codeplug.hh:937
enum TyTButtonSettings::ButtonAction ButtonAction
The possible button actions.
Definition tyt_codeplug.hh:940
Represents a single channel (analog or digital) within the TyT codeplug.
Definition tyt_codeplug.hh:36
static constexpr unsigned int size()
Returns the size of the element.
Definition tyt_codeplug.hh:82
Codeplug representation of the general settings.
Definition tyt_codeplug.hh:528
TyTCodeplug(QObject *parent=nullptr)
Empty constructor.
Definition tyt_codeplug.cc:2912
Represents a zone within the generic configuration.
Definition zone.hh:15
Some internal offsets within the codeplug.
Definition dm1701_codeplug.hh:323