libdrmconf 0.15.1
A library to program DMR radios.
Loading...
Searching...
No Matches
d168uv_codeplug.hh
1#ifndef D168UV_CODEPLUG_HH
2#define D168UV_CODEPLUG_HH
3
4#include <QDateTime>
5
6#include "d878uv_codeplug.hh"
7#include "d878uv_codeplug.hh"
8#include "d878uv_codeplug.hh"
9#include "d878uv_codeplug.hh"
10
11class Channel;
12class DMRContact;
13class Zone;
14class RXGroupList;
15class ScanList;
16class DMRAPRSSystem;
17
18
26{
27 Q_OBJECT
28
29public:
32 {
33 public:
35 ChannelElement(uint8_t *ptr);
36
38 virtual bool dmrCRCDisabled() const;
40 virtual void disableDMRCRC(bool disable);
41
43 Channel *toChannelObj(Context &ctx) const override;
45 bool fromChannelObj(const Channel *c, Context &ctx) override;
46
47 protected:
51 static constexpr Bit disableDMRCRC() { return {34, 3}; }
53 };
54 };
55
56
60 {
61 protected:
62 protected:
64 struct KeyFunction {
65 public:
70
71 protected:
73 typedef enum {
74 Off = 0x00, Voltage = 0x01, Power = 0x02, Repeater = 0x03, Reverse = 0x04,
75 Encryption = 0x05, Call = 0x06, VOX = 0x07, ToggleVFO = 0x08, SubPTT = 0x09,
76 Scan = 0x0a, WFM = 0x0b, Alarm = 0x0c, RecordSwitch = 0x0d, Record = 0x0e, SMS = 0x0f,
77 Dial = 0x10, GPSInformation = 0x11, Monitor = 0x12, ToggleMainChannel = 0x13, HotKey1 = 0x14,
78 HotKey2 = 0x15, HotKey3 = 0x16, HotKey4 = 0x17, HotKey5 = 0x18, HotKey6 = 0x19,
79 WorkAlone = 0x1a, SkipChannel = 0x1b, DMRMonitor = 0x1c, SubChannel = 0x1d,
80 PriorityZone = 0x1e, VFOScan = 0x1f, MICSoundQuality = 0x20, LastCallReply = 0x21,
81 ChannelType = 0x22, Ranging = 0x23, Roaming = 0x24, ChannelRanging = 0x25,
82 MaxVolume = 0x26, Slot = 0x27, APRSType = 0x28, Zone = 0x29, RoamingSet = 0x2a,
83 APRSSet = 0x2b, Mute=0x2c, CtcssDcsSet=0x2d, TBSTSend = 0x2e, Bluetooth = 0x2f,
84 GPS = 0x30, ChannelName = 0x31, CDTScan = 0x32, APRSSend = 0x33, DIMShut = 0x34,
85 GPSRoaming = 0x35, WXAlarm = 0x36, Squelch = 0x37, ChannelSettings = 0x38,
86 SatPredict = 0x39
88 };
89
91 struct TimeZone {
92 public:
94 static uint8_t encode(const QTimeZone& zone);
96 static QTimeZone decode(uint8_t code);
97
98 protected:
100 static QVector<QTimeZone> _timeZones;
101 };
102
103 public:
105 explicit GeneralSettingsElement(uint8_t *ptr);
106
107 QTimeZone gpsTimeZone() const override;
108 void setGPSTimeZone(const QTimeZone &zone) override;
109
110 // These function keys are not present
123
128
137
138 bool fromConfig(const Flags &flags, Context &ctx, const ErrorStack &err) override;
139 bool updateConfig(Context &ctx, const ErrorStack &err) override;
140
141 protected:
144 static constexpr unsigned int progFuncKeyALong() { return 0x0012; }
145 static constexpr unsigned int progFuncKeyBLong() { return 0x0013; }
146 static constexpr unsigned int progFuncKeyAVeryLong() { return 0x0041; }
147 static constexpr unsigned int progFuncKeyBVeryLong() { return 0x0042; }
149 };
150 };
151
155 {
156 protected:
158 enum class TalkerAliasType {
159 RadioName = 0, CustomText = 1
160 };
161
162 public:
164 ExtendedSettingsElement(uint8_t *ptr);
165
166 // Size changed
167 static constexpr unsigned int size() { return 0x100; }
168
169 bool fromConfig(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack()) override;
170
171 protected:
174 static constexpr unsigned int talkerAliasType() { return 0x0001; }
176 };
177 };
178
182 {
183 public:
185 explicit FixedLocationNamesElement(uint8_t *ptr);
186
188 static constexpr unsigned int size() { return 0x0090; }
189
190 void clear() override;
191
193 virtual QString name(unsigned int n) const;
195 virtual void setName(unsigned int n, const QString &name);
196
197 public:
201 static constexpr unsigned int nameCount() { return 8; }
202 static constexpr unsigned int nameLength() { return 16; }
203 };
204
205 protected:
209 static constexpr unsigned int names() { return 0x0003; }
210 static constexpr unsigned int betweenNames() { return Limit::nameLength() + 1; }
212 };
213 };
214
215protected:
217 explicit D168UVCodeplug(const QString &label, QObject *parent = nullptr);
218
219public:
221 explicit D168UVCodeplug(QObject *parent = nullptr);
222
223protected:
224 void allocateUpdated() override;
225
226 bool encodeChannels(const Flags &flags, Context &ctx, const ErrorStack &err) override;
227 bool createChannels(Context &ctx, const ErrorStack &err) override;
228 bool linkChannels(Context &ctx, const ErrorStack &err) override;
229
230 bool encodeGeneralSettings(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack()) override;
231 bool decodeGeneralSettings(Context &ctx, const ErrorStack &err=ErrorStack()) override;
232 bool linkGeneralSettings(Context &ctx, const ErrorStack &err=ErrorStack()) override;
233
234protected:
238 static constexpr unsigned int fixedLocationNames() { return 0x02504800; }
239 static constexpr unsigned int unknown_25c2000() { return 0x025c2000; }
240 static constexpr unsigned int unknown_25c2c80() { return 0x025c2c80; }
242 };
243};
244
245#endif // D168UV_CODEPLUG_HH
virtual void clear()
Clears and resets the complete codeplug to some default values.
Definition anytone_codeplug.cc:4530
KeyFunction
All possible key functions.
Definition anytone_settingsextension.hh:201
The base class of all channels (analog and digital) of a codeplug configuration.
Definition channel.hh:38
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
Channel * toChannelObj(Context &ctx) const override
Constructs a Channel object from this element.
Definition d168uv_codeplug.cc:28
bool fromChannelObj(const Channel *c, Context &ctx) override
Encodes the given channel object.
Definition d168uv_codeplug.cc:44
ChannelElement(uint8_t *ptr)
Constructor.
Definition d168uv_codeplug.cc:10
virtual bool dmrCRCDisabled() const
Returns true if the CRC check for DMR channels is disabled.
Definition d168uv_codeplug.cc:17
virtual void disableDMRCRC(bool disable)
Disables DMR CRC check.
Definition d168uv_codeplug.cc:22
TalkerAliasType
Encoding of possible talker-alias types.
Definition d168uv_codeplug.hh:158
ExtendedSettingsElement(uint8_t *ptr)
Constructor.
Definition d168uv_codeplug.cc:392
bool fromConfig(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack()) override
Encodes the settings from the config.
Definition d168uv_codeplug.cc:399
virtual QString name(unsigned int n) const
Returns the n-th name.
Definition d168uv_codeplug.cc:426
static constexpr unsigned int size()
Size of the element.
Definition d168uv_codeplug.hh:188
virtual void setName(unsigned int n, const QString &name)
Sets the n-th name.
Definition d168uv_codeplug.cc:433
FixedLocationNamesElement(uint8_t *ptr)
Constructor.
Definition d168uv_codeplug.cc:413
AnytoneKeySettingsExtension::KeyFunction funcKey1Short() const override
Returns the key function for a short press on the function key 1.
Definition d168uv_codeplug.cc:262
void setFuncKeyALong(AnytoneKeySettingsExtension::KeyFunction func) override
Sets the key function for a long press on the function key 1.
Definition d168uv_codeplug.cc:309
void setGPSTimeZone(const QTimeZone &zone) override
Sets the GPS time zone.
Definition d168uv_codeplug.cc:237
AnytoneKeySettingsExtension::KeyFunction funcKeyALong() const override
Returns the key function for a long press on the function key 1.
Definition d168uv_codeplug.cc:303
virtual void setFuncKeyAVeryLong(AnytoneKeySettingsExtension::KeyFunction func)
Sets the function for the very-long press of side key 1.
Definition d168uv_codeplug.cc:333
AnytoneKeySettingsExtension::KeyFunction funcKeyCLong() const override
Returns the key function for a long press on the function key 3.
Definition d168uv_codeplug.cc:252
virtual AnytoneKeySettingsExtension::KeyFunction funcKeyAVeryLong() const
Returns the function for the very-long press of side key 1.
Definition d168uv_codeplug.cc:327
QTimeZone gpsTimeZone() const override
Returns the GPS time zone.
Definition d168uv_codeplug.cc:232
void setFuncKeyCShort(AnytoneKeySettingsExtension::KeyFunction func) override
Sets the key function for a short press on the function key 3/C.
Definition d168uv_codeplug.cc:247
GeneralSettingsElement(uint8_t *ptr)
Constructor.
Definition d168uv_codeplug.cc:224
bool updateConfig(Context &ctx, const ErrorStack &err) override
Updates the abstract config from general settings.
Definition d168uv_codeplug.cc:372
AnytoneKeySettingsExtension::KeyFunction funcKey2Short() const override
Returns the key function for a short press on the function key 2.
Definition d168uv_codeplug.cc:272
AnytoneKeySettingsExtension::KeyFunction funcKey1Long() const override
Returns the key function for a long press on the function key 1.
Definition d168uv_codeplug.cc:282
void setFuncKey2Long(AnytoneKeySettingsExtension::KeyFunction func) override
Sets the key function for a long press on the function key 2.
Definition d168uv_codeplug.cc:297
bool fromConfig(const Flags &flags, Context &ctx, const ErrorStack &err) override
Encodes the general settings.
Definition d168uv_codeplug.cc:351
void setFuncKeyBLong(AnytoneKeySettingsExtension::KeyFunction func) override
Sets the key function for a long press on the function key 2.
Definition d168uv_codeplug.cc:321
void setFuncKey1Short(AnytoneKeySettingsExtension::KeyFunction func) override
Sets the key function for a short press on the function key 1.
Definition d168uv_codeplug.cc:267
virtual void setFuncKeyBVeryLong(AnytoneKeySettingsExtension::KeyFunction func)
Sets the function for the very-long press of side key 2.
Definition d168uv_codeplug.cc:345
void setFuncKey2Short(AnytoneKeySettingsExtension::KeyFunction func) override
Sets the key function for a short press on the function key 2.
Definition d168uv_codeplug.cc:277
AnytoneKeySettingsExtension::KeyFunction funcKeyCShort() const override
Returns the key function for a short press on the function key 3/C.
Definition d168uv_codeplug.cc:242
void setFuncKeyCLong(AnytoneKeySettingsExtension::KeyFunction func) override
Sets the key function for a long press on the function key 3.
Definition d168uv_codeplug.cc:257
AnytoneKeySettingsExtension::KeyFunction funcKey2Long() const override
Returns the key function for a long press on the function key 2.
Definition d168uv_codeplug.cc:292
AnytoneKeySettingsExtension::KeyFunction funcKeyBLong() const override
Returns the key function for a long press on the function key 2.
Definition d168uv_codeplug.cc:315
void setFuncKey1Long(AnytoneKeySettingsExtension::KeyFunction func) override
Sets the key function for a long press on the function key 1.
Definition d168uv_codeplug.cc:287
virtual AnytoneKeySettingsExtension::KeyFunction funcKeyBVeryLong() const
Returns the function for the very-long press of side key 2.
Definition d168uv_codeplug.cc:339
bool encodeChannels(const Flags &flags, Context &ctx, const ErrorStack &err) override
Encode channels into codeplug.
Definition d168uv_codeplug.cc:471
bool encodeGeneralSettings(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack()) override
Encodes the general settings section.
Definition d168uv_codeplug.cc:540
bool decodeGeneralSettings(Context &ctx, const ErrorStack &err=ErrorStack()) override
Decodes the general settings section.
Definition d168uv_codeplug.cc:550
D168UVCodeplug(const QString &label, QObject *parent=nullptr)
Hidden constructor.
Definition d168uv_codeplug.cc:444
void allocateUpdated() override
Allocate all code-plug elements that must be written back to the device to maintain a working codeplu...
Definition d168uv_codeplug.cc:458
bool createChannels(Context &ctx, const ErrorStack &err) override
Create channels from codeplug.
Definition d168uv_codeplug.cc:489
bool linkGeneralSettings(Context &ctx, const ErrorStack &err=ErrorStack()) override
Link the general settings.
Definition d168uv_codeplug.cc:560
bool linkChannels(Context &ctx, const ErrorStack &err) override
Link channels.
Definition d168uv_codeplug.cc:515
Represents the actual channel encoded within the binary D878UV codeplug.
Definition d878uv_codeplug.hh:93
General settings extension element for the D878UV.
Definition d878uv_codeplug.hh:914
static constexpr unsigned int size()
Returns the size of the element.
Definition d878uv_codeplug.hh:937
Represents the general config of the radio within the D878UV binary codeplug.
Definition d878uv_codeplug.hh:322
D878UVCodeplug(const QString &label, QObject *parent=nullptr)
Hidden constructor.
Definition d878uv_codeplug.cc:3919
This class represents a DMR position reporting system within the codeplug.
Definition gpssystem.hh:70
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:43
Generic representation of a RX group list.
Definition rxgrouplist.hh:14
Generic representation of a scan list.
Definition scanlist.hh:15
Represents a zone within the generic configuration.
Definition zone.hh:15
Some internal offsets.
Definition d168uv_codeplug.hh:49
Definition d168uv_codeplug.hh:172
Some limits.
Definition d168uv_codeplug.hh:199
static constexpr unsigned int nameCount()
Number of names.
Definition d168uv_codeplug.hh:201
Some internal offsets.
Definition d168uv_codeplug.hh:207
Device specific key functions.
Definition d168uv_codeplug.hh:64
static AnytoneKeySettingsExtension::KeyFunction decode(uint8_t code)
Decodes key function.
Definition d168uv_codeplug.cc:154
static uint8_t encode(AnytoneKeySettingsExtension::KeyFunction tone)
Encodes key function.
Definition d168uv_codeplug.cc:89
KeyFunctionCode
Device specific key functions.
Definition d168uv_codeplug.hh:73
Definition d168uv_codeplug.hh:142
Device specific time zones.
Definition d168uv_codeplug.hh:91
static QTimeZone decode(uint8_t code)
Decodes time zone.
Definition d168uv_codeplug.cc:72
static QVector< QTimeZone > _timeZones
Vector of possible time-zones.
Definition d168uv_codeplug.hh:62
static uint8_t encode(const QTimeZone &zone)
Encodes time zone.
Definition d168uv_codeplug.cc:78
Internal used offsets within the codeplug.
Definition d168uv_codeplug.hh:236
Internal used offsets within the channel element.
Definition d878uv_codeplug.hh:234
Some internal used offsets within the element.
Definition d878uv_codeplug.hh:823
Some limits.
Definition d878uv_codeplug.hh:1976
Internal offsets within the codeplug.
Definition d878uv_codeplug.hh:1986