libdrmconf 0.12.1
A library to program DMR radios.
Loading...
Searching...
No Matches
md390_codeplug.hh
1#ifndef MD390CODEPLUG_HH
2#define MD390CODEPLUG_HH
3
4#include "dm1701_codeplug.hh"
5
37{
38 Q_OBJECT
39
40public:
46 {
47 protected:
49 ChannelElement(uint8_t *ptr, size_t size);
50
51 public:
53 explicit ChannelElement(uint8_t *ptr);
54
55 void clear();
56
58 virtual bool compressedUDPHeader() const;
60 virtual void enableCompressedUDPHeader(bool enable);
61
63 virtual Channel *toChannelObj(const ErrorStack &err=ErrorStack()) const;
65 virtual void fromChannelObj(const Channel *c, Context &ctx);
66 };
67
73 {
74 protected:
76 MenuSettingsElement(uint8_t *ptr, size_t size);
77
78 public:
80 explicit MenuSettingsElement(uint8_t *ptr);
81
82 void clear();
83
85 virtual bool gpsInformation() const;
87 virtual void enableGPSInformation(bool enable);
88
89 bool fromConfig(const Config *config);
90 bool updateConfig(Config *config);
91 };
92
93public:
95 explicit MD390Codeplug(QObject *parent=nullptr);
96
97 Config *preprocess(Config *config, const ErrorStack &err) const;
98 bool postprocess(Config *config, const ErrorStack &err) const;
99
100 virtual bool decodeElements(Context &ctx, const ErrorStack &err=ErrorStack());
101
102 void clearTimestamp();
103 bool encodeTimestamp();
104
106 bool encodeGeneralSettings(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
107 bool decodeGeneralSettings(Config *config, const ErrorStack &err=ErrorStack());
108
109 void clearChannels();
110 bool encodeChannels(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
111 bool createChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
112 bool linkChannels(Context &ctx, const ErrorStack &err=ErrorStack());
113
114 void clearContacts();
115 bool encodeContacts(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
116 bool createContacts(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
117
118 void clearZones();
119 bool encodeZones(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
120 bool createZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
121 bool linkZones(Context &ctx, const ErrorStack &err=ErrorStack());
122
123 void clearGroupLists();
124 bool encodeGroupLists(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
125 bool createGroupLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
126 bool linkGroupLists(Context &ctx, const ErrorStack &err=ErrorStack());
127
128 void clearScanLists();
129 bool encodeScanLists(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
130 bool createScanLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
131 bool linkScanLists(Context &ctx, const ErrorStack &err=ErrorStack());
132
134 bool encodePositioningSystems(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
135 bool createPositioningSystems(Config *config, Context &ctx, const ErrorStack &err=ErrorStack());
136 bool linkPositioningSystems(Context &ctx, const ErrorStack &err=ErrorStack());
137
138 void clearButtonSettings();
139 bool encodeButtonSettings(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack());
140 bool decodeButtonSetttings(Config *config, const ErrorStack &err=ErrorStack());
141
142 void clearPrivacyKeys();
143 bool encodePrivacyKeys(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err);
144 bool decodePrivacyKeys(Config *config, Context &ctx, const ErrorStack &err);
145
146 void clearTextMessages();
147 bool encodeTextMessages(Context &ctx, const Flags &flags, const ErrorStack &err);
148 bool decodeTextMessages(Context &ctx, const ErrorStack &err);
149
150 void clearMenuSettings();
152
153protected:
155 struct Offset {
157 static constexpr unsigned int messages() { return 0x002180; }
159 };
160};
161
162#endif // MD390CODEPLUG_HH
The base class of all channels (analog and digital) of a codeplug configuration.
Definition channel.hh:34
Base class for all codeplug contexts.
Definition codeplug.hh:273
Certain flags passed to CodePlug::encode to control the transfer and encoding of the codeplug.
Definition codeplug.hh:26
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
Extends the common TyTCodeplug::ChannelElement to implement the DM-1701 specific settings.
Definition dm1701_codeplug.hh:58
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:41
Extends the common TyTCodeplug::ChannelElement to implement the MD-390 specific settings.
Definition md390_codeplug.hh:46
virtual void enableCompressedUDPHeader(bool enable)
Enables/disables 'compressed UDP data header'.
Definition md390_codeplug.cc:72
void clear()
Abstract method to reset the element within the codeplug.
Definition md390_codeplug.cc:61
virtual Channel * toChannelObj(const ErrorStack &err=ErrorStack()) const
Constructs a generic Channel object from the codeplug channel.
Definition md390_codeplug.cc:77
virtual bool compressedUDPHeader() const
Returns true if the 'compressed UDP data header' is enabled.
Definition md390_codeplug.cc:68
ChannelElement(uint8_t *ptr, size_t size)
Hidden constructor.
Definition md390_codeplug.cc:48
virtual void fromChannelObj(const Channel *c, Context &ctx)
Initializes this codeplug channel from the given generic configuration.
Definition md390_codeplug.cc:91
Extends the TyTCodeplug::MenuSettingsElement to implement the MD-390 specific menu settings.
Definition md390_codeplug.hh:73
bool fromConfig(const Config *config)
Encodes the menu settings.
Definition md390_codeplug.cc:133
virtual bool gpsInformation() const
Returns true if GPS information is enabled.
Definition md390_codeplug.cc:124
bool updateConfig(Config *config)
Updates config from menu settings.
Definition md390_codeplug.cc:145
MenuSettingsElement(uint8_t *ptr, size_t size)
Hidden constructor.
Definition md390_codeplug.cc:104
virtual void enableGPSInformation(bool enable)
Enables/disables GPS information menu.
Definition md390_codeplug.cc:128
void clear()
Abstract method to reset the element within the codeplug.
Definition md390_codeplug.cc:117
Device specific implementation of the codeplug for the TyT MD-390(U/V).
Definition md390_codeplug.hh:37
bool encodeGroupLists(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all group lists in the configuration into the codeplug.
Definition md390_codeplug.cc:405
bool createZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds a zone to the configuration for each one in the codeplug.
Definition md390_codeplug.cc:358
void clearTextMessages()
Clears all text messages in the codeplug.
Definition md390_codeplug.cc:604
void clearPrivacyKeys()
Clears all encryption keys in the codeplug.
Definition md390_codeplug.cc:574
void clearScanLists()
Clears all scan lists in the codeplug.
Definition md390_codeplug.cc:448
bool encodeChannels(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all channels in the configuration into the codeplug.
Definition md390_codeplug.cc:247
bool encodeTextMessages(Context &ctx, const Flags &flags, const ErrorStack &err)
Encodes text messages.
Definition md390_codeplug.cc:609
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 md390_codeplug.cc:204
bool createChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds a channel to the configuration for each one in the codeplug.
Definition md390_codeplug.cc:262
MD390Codeplug(QObject *parent=nullptr)
Empty constructor.
Definition md390_codeplug.cc:160
bool encodeTimestamp()
Sets the time-stamp.
Definition md390_codeplug.cc:216
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 md390_codeplug.cc:523
bool encodeScanLists(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all scan lists in the configuration into the codeplug.
Definition md390_codeplug.cc:455
bool decodeGeneralSettings(Config *config, const ErrorStack &err=ErrorStack())
Updates the given configuration from the general settings.
Definition md390_codeplug.cc:234
bool linkScanLists(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added scan lists within the configuration.
Definition md390_codeplug.cc:485
bool createContacts(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds a digital contact to the configuration for each one in the codeplug.
Definition md390_codeplug.cc:313
bool encodePrivacyKeys(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err)
Encodes the encryption keys.
Definition md390_codeplug.cc:579
bool postprocess(Config *config, const ErrorStack &err) const
Retruns a post-processed configuration of the decoded config.
Definition md390_codeplug.cc:188
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 md390_codeplug.cc:418
bool encodeButtonSettings(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes the button settings.
Definition md390_codeplug.cc:560
bool encodeZones(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all zones in the configuration into the codeplug.
Definition md390_codeplug.cc:337
bool createScanLists(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds a scan list to the configuration for each one in the codeplug.
Definition md390_codeplug.cc:469
bool linkZones(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added zones within the configuration.
Definition md390_codeplug.cc:375
bool decodeButtonSetttings(Config *config, const ErrorStack &err=ErrorStack())
Decodes the button settings.
Definition md390_codeplug.cc:567
bool decodePrivacyKeys(Config *config, Context &ctx, const ErrorStack &err)
Decodes the encryption keys.
Definition md390_codeplug.cc:590
bool linkPositioningSystems(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added positioning systems within the configuration.
Definition md390_codeplug.cc:540
void clearChannels()
Clears all channels in the codeplug.
Definition md390_codeplug.cc:240
void clearContacts()
Clears all contacts in the codeplug.
Definition md390_codeplug.cc:292
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 md390_codeplug.cc:507
void clearGeneralSettings()
Clears the general settings in the codeplug.
Definition md390_codeplug.cc:223
void clearZones()
Clears all zones in the codeplug.
Definition md390_codeplug.cc:329
void clearGroupLists()
Clears all RX group lists in the codeplug.
Definition md390_codeplug.cc:399
void clearEmergencySystems()
Clears all emergency systems in the codeplug.
Definition md390_codeplug.cc:625
bool encodeContacts(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all digital contacts in the configuration into the codeplug.
Definition md390_codeplug.cc:299
void clearMenuSettings()
Clears the menu settings in the codeplug.
Definition md390_codeplug.cc:620
bool linkGroupLists(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added RX group lists within the configuration.
Definition md390_codeplug.cc:434
void clearTimestamp()
Clears the time-stamp in the codeplug.
Definition md390_codeplug.cc:211
bool linkChannels(Context &ctx, const ErrorStack &err=ErrorStack())
Links all added channels within the configuration.
Definition md390_codeplug.cc:278
bool decodeTextMessages(Context &ctx, const ErrorStack &err)
Decodes text messages.
Definition md390_codeplug.cc:614
Config * preprocess(Config *config, const ErrorStack &err) const
Retruns a prepared configuration for this particular radio.
Definition md390_codeplug.cc:170
bool encodeGeneralSettings(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Updates the general settings from the given configuration.
Definition md390_codeplug.cc:228
void clearPositioningSystems()
Clears all positioning systems in the codeplug.
Definition md390_codeplug.cc:500
void clearButtonSettings()
Clears the button settings in the codeplug.
Definition md390_codeplug.cc:555
Represents all menu settings within the codeplug on the radio.
Definition tyt_codeplug.hh:699
Base class of all TyT codeplugs.
Definition tyt_codeplug.hh:26
Some internal offsets within the codeplug.
Definition md390_codeplug.hh:155