libdrmconf  0.12.0
A library to program DMR radios.
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
GD73Codeplug::SettingsElement Class Reference

Implements the radio settings. More...

#include <gd73_codeplug.hh>

Inheritance diagram for GD73Codeplug::SettingsElement:
Inheritance graph
[legend]
Collaboration diagram for GD73Codeplug::SettingsElement:
Collaboration graph
[legend]

Classes

struct  KeyFunction
 Possible programmable key function. More...
 
struct  Limit
 Some limits of the settings. More...
 
struct  Offset
 Internal offsets within the element. More...
 

Public Types

enum class  ChannelDisplayMode { Name = 0 , Frequency = 1 }
 Possible channel display modes.
 
enum class  BootDisplayMode { Off = 0 , Text = 1 , Image = 2 , Both = 3 }
 Possible boot display modes.
 
enum class  Language { Chinese =0 , English =1 }
 Possible languages.
 

Public Member Functions

 SettingsElement (uint8_t *ptr)
 Constructor.
 
QString name () const
 Returns the radio name.
 
void setName (const QString &name)
 Sets the radio name.
 
unsigned int dmrID () const
 Returns the radio ID.
 
void setDMRID (unsigned int id)
 Sets the radio ID.
 
Language language () const
 Retruns the menu language.
 
void setLanguage (Language lang)
 Sets the menu language.
 
unsigned int vox () const
 Returns the VOX level [0,10].
 
void setVOX (unsigned int level)
 Sets the VOX level [0,10].
 
unsigned int squelch () const
 Returns the squelch level [0,10].
 
void setSquelch (unsigned int level)
 Sets the squelch level [0,10].
 
bool totIsSet () const
 Returns true, if a transmit time-out is set.
 
Interval tot () const
 Returns the transmit time-out.
 
void setTOT (const Interval &interval)
 Sets the transmit time-out.
 
void clearTOT ()
 Disables transmit time-out.
 
bool txInterruptedEnabled () const
 Returns true if the TX interrupt is enabled.
 
void enableTXInterrupt (bool enable)
 Enables/disables the TX interrupt.
 
bool powerSaveEnabled () const
 Returns true if power save is enabled.
 
void enablePowerSave (bool enable)
 Enables/disables power save.
 
Interval powerSaveTimeout () const
 Returns the power-save time-out.
 
void setPowerSaveTimeout (const Interval &interval)
 Sets the power-save time-out.
 
bool readLockEnabled () const
 Returns true, if the read lock is enabled.
 
void enableReadLock (bool enable)
 Enables/disables read lock.
 
QString readLockPin () const
 Returns the read-lock pin (1-6 digits as ASCII).
 
void setReadLockPin (const QString &pin)
 Sets the read-lock pin (1-6 digits as ASCII).
 
bool writeLockEnabled () const
 Returns true, if the write lock is enabled.
 
void enableWriteLock (bool enable)
 Enables/disables write lock.
 
QString writeLockPin () const
 Returns the write-lock pin (1-6 digits as ASCII).
 
void setWriteLockPin (const QString &pin)
 Sets the write-lock pin (1-6 digits as ASCII).
 
ChannelDisplayMode channelDisplayMode () const
 Returns the channel display mode.
 
void setChannelDisplayMode (ChannelDisplayMode mode)
 Sets the channel display mode.
 
unsigned int dmrMicGain () const
 Returns the DMR microphone gain [1,10].
 
void setDMRMicGain (unsigned int gain)
 Sets the DMR microphone gain [1,10].
 
unsigned int fmMicGain () const
 Returns the FM microphone gain [1,10].
 
void setFMMicGain (unsigned int gain)
 Sets the FM microphone gain [1,10].
 
Interval loneWorkerResponseTimeout () const
 Returns the lone-worker response time-out.
 
void setLoneWorkerResponseTimeout (const Interval &interval)
 Sets the lone-worker response time-out.
 
Interval loneWorkerRemindPeriod () const
 Returns the lone-worker remind period.
 
void setLoneWorkerRemindPeriod (const Interval &interval)
 Sets the lone-worker remind period.
 
BootDisplayMode bootDisplayMode () const
 Returns the boot display mode.
 
void setBootDisplayMode (BootDisplayMode mode)
 Sets the boot display mode.
 
QString bootTextLine1 () const
 Returns the first line of the boot text.
 
void setBootTextLine1 (const QString &line)
 Sets the first line of the boot text.
 
QString bootTextLine2 () const
 Returns the second line of the boot text.
 
void setBootTextLine2 (const QString &line)
 Sets the second line of the boot text.
 
bool keyToneEnabled () const
 Returns true if the key tones are enabled.
 
void enableKeyTone (bool enable)
 Enables/disables the key tones.
 
unsigned int keyToneVolume () const
 Returns the key-tone volume [0-13].
 
void setKeyToneVolume (unsigned int vol)
 Sets the key-tone volume.
 
bool lowBatteryToneEnabled () const
 Returns true if the low-battery warn tone is enabled.
 
void enableLowBatteryTone (bool enable)
 Enables/disables the low-battery warn tone.
 
unsigned int lowBatteryToneVolume () const
 Returns the low-battery warn-tone volume [0-13].
 
void setLowBatteryToneVolume (unsigned int vol)
 Sets the low-battery warn-tone volume.
 
Interval longPressDuration () const
 Returns the long-press duration.
 
void setLongPressDuration (const Interval &interval)
 Sets the long-press duration.
 
RadioddityButtonSettingsExtension::Function keyFunctionLongPressP1 () const
 Long-press function of programmable key 1.
 
void setKeyFunctionLongPressP1 (RadioddityButtonSettingsExtension::Function function)
 Sets the long-press function of the programmable key 1.
 
RadioddityButtonSettingsExtension::Function keyFunctionShortPressP1 () const
 Short-press function of programmable key 1.
 
void setKeyFunctionShortPressP1 (RadioddityButtonSettingsExtension::Function function)
 Sets the short-press function of the programmable key 1.
 
RadioddityButtonSettingsExtension::Function keyFunctionLongPressP2 () const
 Long-press function of programmable key 2.
 
void setKeyFunctionLongPressP2 (RadioddityButtonSettingsExtension::Function function)
 Sets the long-press function of the programmable key 2.
 
RadioddityButtonSettingsExtension::Function keyFunctionShortPressP2 () const
 Short-press function of programmable key 2.
 
void setKeyFunctionShortPressP2 (RadioddityButtonSettingsExtension::Function function)
 Sets the short-press function of the programmable key 2.
 
OneTouchSettingElement oneTouch (unsigned int n)
 Returns the n-th one-touch setting.
 
bool updateConfig (Context &ctx, const ErrorStack &err=ErrorStack())
 Updates the given config.
 
bool encode (Context &ctx, const ErrorStack &err=ErrorStack())
 Encodes the settings from the given config.
 
- Public Member Functions inherited from Codeplug::Element
 Element (const Element &other)
 Copy constructor.
 
virtual ~Element ()
 Destructor.
 
Elementoperator= (const Element &other)
 Copy assignment.
 
virtual bool isValid () const
 Returns true if the pointer is not null.
 
virtual void clear ()
 Abstract method to reset the element within the codeplug. More...
 
bool fill (uint8_t value, unsigned offset=0, int size=-1)
 Fills the memsets the entire element to the given value.
 
bool getBit (const Offset::BitOffset &offset) const
 Reads a specific bit at the given byte-offset.
 
bool getBit (unsigned offset, unsigned bit) const
 Reads a specific bit at the given byte-offset.
 
void setBit (const Offset::BitOffset &offset, bool value=true)
 Sets a specific bit at the given byte-offset.
 
void setBit (unsigned offset, unsigned bit, bool value=true)
 Sets a specific bit at the given byte-offset.
 
void clearBit (unsigned offset, unsigned bit)
 Clears a specific bit at the given byte-offset.
 
uint8_t getUInt2 (unsigned offset, unsigned bit) const
 Reads a 2bit unsigned integer at the given byte- and bit-offset.
 
void setUInt2 (unsigned offset, unsigned bit, uint8_t value)
 Stores a 2bit unsigned integer at the given byte- and bit-offset.
 
uint8_t getUInt3 (unsigned offset, unsigned bit) const
 Reads a 3bit unsigned integer at the given byte- and bit-offset.
 
void setUInt3 (unsigned offset, unsigned bit, uint8_t value)
 Stores a 3bit unsigned integer at the given byte- and bit-offset.
 
uint8_t getUInt4 (unsigned offset, unsigned bit) const
 Reads a 4bit unsigned integer at the given byte- and bit-offset.
 
void setUInt4 (unsigned offset, unsigned bit, uint8_t value)
 Stores a 4bit unsigned integer at the given byte- and bit-offset.
 
uint8_t getUInt5 (unsigned offset, unsigned bit) const
 Reads a 5bit unsigned integer at the given byte- and bit-offset.
 
void setUInt5 (unsigned offset, unsigned bit, uint8_t value)
 Stores a 5bit iunsinged nteger at the given byte- and bit-offset.
 
uint8_t getUInt6 (unsigned offset, unsigned bit) const
 Reads a 6bit unsigned integer at the given byte- and bit-offset.
 
void setUInt6 (unsigned offset, unsigned bit, uint8_t value)
 Stores a 6bit unsigned integer at the given byte- and bit-offset.
 
uint8_t getUInt8 (unsigned offset) const
 Reads a 8bit unsigned integer at the given byte- and bit-offset.
 
void setUInt8 (unsigned offset, uint8_t value)
 Reads a 8bit unsigned integer at the given byte- and bit-offset.
 
int8_t getInt8 (unsigned offset) const
 Reads a 8bit signed integer at the given byte- and bit-offset.
 
void setInt8 (unsigned offset, int8_t value)
 Reads a 8bit signed integer at the given byte- and bit-offset.
 
uint16_t getUInt16_be (unsigned offset) const
 Reads a 16bit big-endian unsigned integer at the given byte-offset.
 
uint16_t getUInt16_le (unsigned offset) const
 Reads a 16bit little-endian unsigned integer at the given byte-offset.
 
void setUInt16_be (unsigned offset, uint16_t value)
 Stores a 16bit big-endian unsigned integer at the given byte-offset.
 
void setUInt16_le (unsigned offset, uint16_t value)
 Stores a 16bit little-endian unsigned integer at the given byte-offset.
 
uint32_t getUInt24_be (unsigned offset) const
 Reads a 24bit big-endian unsigned integer at the given byte-offset.
 
uint32_t getUInt24_le (unsigned offset) const
 Reads a 24bit little-endian unsigned integer at the given byte-offset.
 
void setUInt24_be (unsigned offset, uint32_t value)
 Stores a 24bit big-endian unsigned integer at the given byte-offset.
 
void setUInt24_le (unsigned offset, uint32_t value)
 Stores a 24bit little-endian unsigned integer at the given byte-offset.
 
uint32_t getUInt32_be (unsigned offset) const
 Reads a 32bit big-endian unsigned integer at the given byte-offset.
 
uint32_t getUInt32_le (unsigned offset) const
 Reads a 32bit little-endian unsigned integer at the given byte-offset.
 
void setUInt32_be (unsigned offset, uint32_t value)
 Stores a 32bit big-endian unsigned integer at the given byte-offset.
 
void setUInt32_le (unsigned offset, uint32_t value)
 Stores a 32bit little-endian unsigned integer at the given byte-offset.
 
uint64_t getUInt64_be (unsigned offset) const
 Reads a 64bit big-endian unsigned integer at the given byte-offset.
 
uint64_t getUInt64_le (unsigned offset) const
 Reads a 64bit little-endian unsigned integer at the given byte-offset.
 
void setUInt64_be (unsigned offset, uint64_t value)
 Stores a 64bit big-endian unsigned integer at the given byte-offset.
 
void setUInt64_le (unsigned offset, uint64_t value)
 Stores a 64bit little-endian unsigned integer at the given byte-offset.
 
uint8_t getBCD2 (unsigned offset) const
 Reads a 2-digit (1-byte/8bit) BDC value in big-endian at the given byte-offset.
 
void setBCD2 (unsigned offset, uint8_t value)
 Stores a 2-digit (1-byte/8bit) BDC value in big-endian at the given byte-offset.
 
uint16_t getBCD4_be (unsigned offset) const
 Reads a 4-digit (2-byte/16bit) BDC value in big-endian at the given byte-offset.
 
void setBCD4_be (unsigned offset, uint16_t value)
 Stores a 4-digit (2-byte/16bit) BDC value in big-endian at the given byte-offset.
 
uint16_t getBCD4_le (unsigned offset) const
 Reads a 4-digit (2-byte/16bit) BDC value in little-endian at the given byte-offset.
 
void setBCD4_le (unsigned offset, uint16_t value)
 Stores a 4-digit (1-byte/16bit) BDC value in little-endian at the given byte-offset.
 
uint32_t getBCD8_be (unsigned offset) const
 Reads a 8-digit (4-byte/32bit) BDC value in big-endian at the given byte-offset.
 
void setBCD8_be (unsigned offset, uint32_t value)
 Stores a 8-digit (4-byte/32bit) BDC value in big-endian at the given byte-offset.
 
uint32_t getBCD8_le (unsigned offset) const
 Reads a 8-digit (4-byte/32bit) BDC value in little-endian at the given byte-offset.
 
void setBCD8_le (unsigned offset, uint32_t value)
 Stores a 8-digit (4-byte/32bit) BDC value in little-endian at the given byte-offset.
 
QString readASCII (unsigned offset, unsigned maxlen, uint8_t eos=0x00) const
 Reads up to maxlen ASCII chars at the given byte-offset using eos as the string termination char.
 
void writeASCII (unsigned offset, const QString &txt, unsigned maxlen, uint8_t eos=0x00)
 Stores up to maxlen ASCII chars at the given byte-offset using eos as the string termination char. More...
 
QString readUnicode (unsigned offset, unsigned maxlen, uint16_t eos=0x0000) const
 Reads up to maxlen unicode chars at the given byte-offset using eos as the string termination char.
 
void writeUnicode (unsigned offset, const QString &txt, unsigned maxlen, uint16_t eos=0x0000)
 Stores up to maxlen unicode chars at the given byte-offset using eos as the string termination char. More...
 

Static Public Member Functions

static constexpr unsigned int size ()
 Returns the size of the settings element.
 

Protected Member Functions

 SettingsElement (uint8_t *ptr, size_t size)
 Hidden constructor.
 
- Protected Member Functions inherited from Codeplug::Element
 Element (uint8_t *ptr, size_t size)
 Hidden constructor. More...
 

Additional Inherited Members

- Protected Attributes inherited from Codeplug::Element
uint8_t * _data
 Holds the pointer to the element.
 
size_t _size
 Holds the size of the element.
 

Detailed Description

Implements the radio settings.

Memory representation within the binary codeplug (size: 00aah):

     7   6   5   4   3   2   1   0   7   6   5   4   3   2   1   0   7   6   5   4   3   2   1   0   7   6   5   4   3   2   1   0
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
00 | Radio name, 16 x Unicode, little-endian, filled/padded with 0x0000                                                         ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
1c  ...                                                                                                                            |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
20 | DMR ID, 24bit unsigned int little endian                                                      | Pad byte 0x00                 |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
24 | Language                      | Unknown 0x00                  | Vox level [0,4]               | Squelch level [0,9]           |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
28 | TOT                           | TX Interrupt enable           | Power-save enable             | Power save timeout            |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
2c | Read lock enable              | Write lock enable             | Unknown 0x00                  | Display mode                  |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
30 | Read lock pin, 6xASCII numbers [0x30,0x39], 0-padded                                                                       ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
34  ...                                                            | Write lock pin, 6xASCII numbers [0x30,0x39], 0-padded      ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
38  ...                                                                                                                            |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
3c | Unknown, 0x01                 | DMR mic gain [0,5]            | Unknown 0x01                  | FM mic gain [0,5]             |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
40 | Lone worker resp. timeout in minutes [1, 480], little endian  | Lone worker reminder period   | Boot display mode             |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
44 | Boot text line 1, 16 x 16bit Unicode, little endian, 0-padded                                                              ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
60  ...                                                                                                                            |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
64 | Boot text line 2, 16 x 16bit Unicode, little endian, 0-padded                                                              ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
80  ...                                                                                                                            |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
84 | Enable key tones              | Key tone volume [0,13]        | Low battery tone enable       | Low battery tone vol. [0,13]  |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
88 | Long press duration           | Unknown                                                       | P1 short press                |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
8c | P1 long press                 | P2 short press                | P2 long press                 | Unused 0x00                   |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
90 | Unused 0x00                   | One-touch 1 settings                                                                       ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
94  ...                                                            | One-touch 2 settings                                       ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
98  ...                                                                                            | One-touch 3 settings       ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
9c  ...                                                                                                                            |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
a0 | One-touch 4 settings                                                                                                       ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
a4  ...                            | One-touch 5 settings                                                                       ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
a8  ...                                                            |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Where:
 - Language: 0x00=Chinese, 0x01=English
 - TOT: Transmit timeout, 0=off, ..., 16=180, ..., 48=500s, N = (T-20)/10
 - Display mode: 0=Channel Name, 1 = Channel Frequency
 - Power-save timeout: Timeout in seconds [10, 60]
 - Lone worker reminder period: in seconds [10, 200]
 - Boot display mode: 0=Off, 1=Text, 2=Image, 3=both
 - Long press duration: In multiple of 0.5s: 0=0s, 1=0.5s, ..., 31=15.5s
 - P1/2 short/long press: 0=None, 1=Radio enable, 2=Radio check, 3=Radio disable, 4=Power level,
   5=Monitor, 6=Emergency on, 7=Emergency Off, 8=Zone switch, 9=Scan toggle, a=VOX toggle,
   b=One touch 1, ..., f=One Touch 5, 10=Talkaround toggle, 11=Lone worker, 12=TBST 1750Hz,
   13=Call/Swell

.


The documentation for this class was generated from the following files: