libdrmconf  0.12.0
A library to program DMR radios.
md2017_codeplug.hh
1 #ifndef MD2017_CODEPLUG_HH
2 #define MD2017_CODEPLUG_HH
3 
4 #include "tyt_codeplug.hh"
5 #include "uv390_codeplug.hh"
6 
52 {
53  Q_OBJECT
54 
55 public:
58 
61 
64 
67 
70 
79  {
80  protected:
82  ContactElement(uint8_t *ptr, size_t size);
83 
84  public:
86  ContactElement(uint8_t *ptr);
87 
88  bool isValid() const;
89  };
90 
91 public:
93  explicit MD2017Codeplug(QObject *parent = nullptr);
95  virtual ~MD2017Codeplug();
96 
97 public:
98  void clearTimestamp();
99  bool encodeTimestamp();
100 
101  void clearGeneralSettings();
102  bool encodeGeneralSettings(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
103  bool decodeGeneralSettings(Config *config, const ErrorStack &err=ErrorStack());
104 
105  void clearChannels();
106  bool encodeChannels(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
107  bool createChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
108  bool linkChannels(Context &ctx, const ErrorStack &err=ErrorStack());
109 
110  void clearContacts();
111  bool encodeContacts(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
112  bool createContacts(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
113 
114  void clearZones();
115  bool encodeZones(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
116  bool createZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
117  bool linkZones(Context &ctx, const ErrorStack &err=ErrorStack());
118 
119  void clearGroupLists();
120  bool encodeGroupLists(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
121  bool createGroupLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
122  bool linkGroupLists(Context &ctx, const ErrorStack &err=ErrorStack());
123 
124  void clearScanLists();
125  bool encodeScanLists(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
126  bool createScanLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
127  bool linkScanLists(Context &ctx, const ErrorStack &err=ErrorStack());
128 
130  bool encodePositioningSystems(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
131  bool createPositioningSystems(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
132  bool linkPositioningSystems(Context &ctx, const ErrorStack &err=ErrorStack());
133 
134  void clearButtonSettings();
135  bool encodeButtonSettings(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
136  bool decodeButtonSetttings(Config *config, const ErrorStack &err=ErrorStack());
137 
138  void clearPrivacyKeys();
139  bool encodePrivacyKeys(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err);
140  bool decodePrivacyKeys(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
141 
142  void clearTextMessages();
143  bool encodeTextMessages(Context &ctx, const Flags &flags, const ErrorStack &err);
144  bool decodeTextMessages(Context &ctx, const ErrorStack &err);
145 
147  virtual void clearBootSettings();
148  void clearMenuSettings();
149  void clearEmergencySystems();
151  virtual void clearVFOSettings();
152 
153 protected:
155  struct Offset {
157  static constexpr unsigned int messages() { return 0x002180; }
159  };
160 };
161 
162 #endif // MD2017_CODEPLUG_HH
Base class for all codeplug contexts.
Definition: codeplug.hh:238
Certain flags passed to CodePlug::encode to control the transfer and encoding of the codeplug.
Definition: codeplug.hh:25
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
Extended zone data for the DM-1701.
Definition: dm1701_codeplug.hh:228
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Contact element for MD2017 codeplugs.
Definition: md2017_codeplug.hh:79
bool isValid() const
Returns true if the pointer is not null.
Definition: md2017_codeplug.cc:62
ContactElement(uint8_t *ptr, size_t size)
Hidden constructor.
Definition: md2017_codeplug.cc:49
Device specific implementation of the codeplug for the TyT MD-2017.
Definition: md2017_codeplug.hh:52
bool encodeGroupLists(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all group lists in the configuration into the codeplug.
Definition: md2017_codeplug.cc:281
virtual void clearVFOSettings()
Resets VFO settings.
Definition: md2017_codeplug.cc:514
virtual void clearBootSettings()
Resets/clears the boot settings.
Definition: md2017_codeplug.cc:429
void clearTextMessages()
Clears all text messages in the codeplug.
Definition: md2017_codeplug.cc:491
UV390Codeplug::ZoneExtElement ZoneExtElement
Reuse TyT MD-UV390 zone extension element.
Definition: md2017_codeplug.hh:63
bool encodeChannels(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all channels in the configuration into the codeplug.
Definition: md2017_codeplug.cc:119
bool linkZones(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added zones within the configuration.
Definition: md2017_codeplug.cc:255
bool linkPositioningSystems(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added positioning systems within the configuration.
Definition: md2017_codeplug.cc:414
void clearMenuSettings()
Clears the menu settings in the codeplug.
Definition: md2017_codeplug.cc:434
bool decodePrivacyKeys(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Decodes the encryption keys.
Definition: md2017_codeplug.cc:477
void clearTimestamp()
Clears the time-stamp in the codeplug.
Definition: md2017_codeplug.cc:83
UV390Codeplug::MenuSettingsElement MenuSettingsElement
Reuse TyT MD-UV390 menu settings element.
Definition: md2017_codeplug.hh:69
bool createScanLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds a scan list to the configuration for each one in the codeplug.
Definition: md2017_codeplug.cc:345
void clearChannels()
Clears all channels in the codeplug.
Definition: md2017_codeplug.cc:112
bool createZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds a zone to the configuration for each one in the codeplug.
Definition: md2017_codeplug.cc:238
bool decodeTextMessages(Context &ctx, const ErrorStack &err)
Decodes text messages.
Definition: md2017_codeplug.cc:501
void clearContacts()
Clears all contacts in the codeplug.
Definition: md2017_codeplug.cc:175
UV390Codeplug::ChannelElement ChannelElement
Reuse TyT MD-UV390 channel element.
Definition: md2017_codeplug.hh:57
bool encodeScanLists(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all scan lists in the configuration into the codeplug.
Definition: md2017_codeplug.cc:331
void clearGroupLists()
Clears all RX group lists in the codeplug.
Definition: md2017_codeplug.cc:275
bool encodeButtonSettings(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes the button settings.
Definition: md2017_codeplug.cc:444
UV390Codeplug::BootSettingsElement BootSettingsElement
Reuse TyT MD-UV390 boot settings element.
Definition: md2017_codeplug.hh:66
bool encodeContacts(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all digital contacts in the configuration into the codeplug.
Definition: md2017_codeplug.cc:182
void clearEmergencySystems()
Clears all emergency systems in the codeplug.
Definition: md2017_codeplug.cc:507
bool encodePositioningSystems(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all DMR positioning systems in the configuration into the codeplug.
Definition: md2017_codeplug.cc:384
void clearGeneralSettings()
Clears the general settings in the codeplug.
Definition: md2017_codeplug.cc:95
bool encodeTextMessages(Context &ctx, const Flags &flags, const ErrorStack &err)
Encodes text messages.
Definition: md2017_codeplug.cc:496
UV390Codeplug::VFOChannelElement VFOChannelElement
Reuse TyT MD-UV390 VFO channel element.
Definition: md2017_codeplug.hh:60
bool linkScanLists(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added scan lists within the configuration.
Definition: md2017_codeplug.cc:362
bool encodePrivacyKeys(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err)
Encodes the encryption keys.
Definition: md2017_codeplug.cc:463
void clearScanLists()
Clears all scan lists in the codeplug.
Definition: md2017_codeplug.cc:324
bool linkChannels(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added channels within the configuration.
Definition: md2017_codeplug.cc:155
void clearPrivacyKeys()
Clears all encryption keys in the codeplug.
Definition: md2017_codeplug.cc:458
bool encodeZones(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all zones in the configuration into the codeplug.
Definition: md2017_codeplug.cc:221
bool linkGroupLists(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added RX group lists within the configuration.
Definition: md2017_codeplug.cc:310
void clearButtonSettings()
Clears the button settings in the codeplug.
Definition: md2017_codeplug.cc:439
bool decodeGeneralSettings(Config *config, const ErrorStack &err=ErrorStack())
Updates the given configuration from the general settings.
Definition: md2017_codeplug.cc:106
bool createGroupLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds a RX group list to the configuration for each one in the codeplug.
Definition: md2017_codeplug.cc:294
bool createChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds a channel to the configuration for each one in the codeplug.
Definition: md2017_codeplug.cc:134
bool encodeGeneralSettings(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Updates the general settings from the given configuration.
Definition: md2017_codeplug.cc:100
void clearPositioningSystems()
Clears all positioning systems in the codeplug.
Definition: md2017_codeplug.cc:377
bool createContacts(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds a digital contact to the configuration for each one in the codeplug.
Definition: md2017_codeplug.cc:196
virtual ~MD2017Codeplug()
Destructor.
Definition: md2017_codeplug.cc:78
bool createPositioningSystems(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds a GPS positioning system to the configuration for each one in the codeplug.
Definition: md2017_codeplug.cc:397
MD2017Codeplug(QObject *parent=nullptr)
Constructor.
Definition: md2017_codeplug.cc:67
bool decodeButtonSetttings(Config *config, const ErrorStack &err=ErrorStack())
Decodes the button settings.
Definition: md2017_codeplug.cc:451
void clearZones()
Clears all zones in the codeplug.
Definition: md2017_codeplug.cc:212
bool encodeTimestamp()
Sets the time-stamp.
Definition: md2017_codeplug.cc:88
Represents a digital (DMR) contact within the codeplug.
Definition: tyt_codeplug.hh:260
Base class of all TyT codeplugs.
Definition: tyt_codeplug.hh:26
Represents the boot-time settings (selected zone and channels) within the UV390 code-plug.
Definition: uv390_codeplug.hh:212
Extends the TyTCodeplug::ChannelElement for the TyT MD-UV390 and Retevis RT3S.
Definition: uv390_codeplug.hh:60
Represents the menu settings (selected zone and channels) within the UV390 code-plug.
Definition: uv390_codeplug.hh:244
Implements a VFO channel for TyT radios.
Definition: uv390_codeplug.hh:118
Some internal offsets within the codeplug.
Definition: md2017_codeplug.hh:155