libdrmconf
0.12.0
A library to program DMR radios.
|
Implements the binary encoding of the settings element. More...
#include <dr1801uv_codeplug.hh>
Classes | |
struct | Limit |
Some limits. More... | |
struct | Offset |
Some offsets within the element. More... | |
Public Types | |
enum class | PowerSaveMode { Off = 0 , Save50 = 1 , Save25 = 2 , Save12 = 3 } |
Possible power-save modes. | |
enum class | Language { SimplifiedChinese = 0 , English = 1 } |
Possible UI languages. | |
enum class | SquelchMode { Normal = 0 , Silent = 1 } |
Possible squelch modes. | |
enum class | RingTone { Off = 0 , RingTone1 = 1 , RingTone2 = 2 , RingTone3 = 3 , RingTone4 = 4 , RingTone5 = 5 , RingTone6 = 6 , RingTone7 = 7 , RingTone8 = 8 , RingTone9 = 9 , RingTone10 = 10 , RingTone11 = 11 , RingTone12 = 12 , RingTone13 = 13 , RingTone14 = 14 , RingTone15 = 15 , RingTone16 = 16 , RingTone17 = 17 , RingTone18 = 18 , RingTone19 = 19 , RingTone20 = 20 } |
Possible ring tone variants. | |
enum class | BacklightTime { Infinite = 0 , Off = 1 , On5s = 2 , On10s = 3 } |
Possible backlight time settings. | |
enum class | TuningMode { Channel = 0 , VFO = 1 } |
Possible tuning modes. | |
enum class | DisplayMode { Number = 0 , Name = 1 , Frequency = 2 } |
Possible display modes. | |
enum class | DualWatchMode { Off = 0 , DoubleDouble = 1 , DoubleSingle = 2 } |
Possible dual-watch modes. | |
enum class | ScanMode { Time = 0 , Carrier = 1 , Search = 2 } |
Possible scan modes. | |
enum class | BootScreen { Picture = 0 , Text = 1 } |
Possible boot screen modes. | |
Public Member Functions | |
SettingsElement (uint8_t *ptr) | |
Constructor. | |
void | clear () |
Abstract method to reset the element within the codeplug. More... | |
virtual unsigned int | dmrID () const |
Returns the radios DMR ID. | |
virtual void | setDMRID (unsigned int id) |
Sets the radios DMR ID. | |
virtual PowerSaveMode | powerSaveMode () const |
Retunrs the the power-save mode. | |
virtual void | setPowerSaveMode (PowerSaveMode mode) |
Sets the power-save mode. More... | |
virtual unsigned int | voxSensitivity () const |
Returns the VOX sensitivity [0,10]. More... | |
virtual void | setVOXSensitivity (unsigned int sens) |
Sets the VOX sensitivity [0,10]. More... | |
virtual unsigned int | voxDelay () const |
Returns the VOX delay in ms. | |
virtual void | setVOXDelay (unsigned int ms) |
Sets the VOX delay in ms. | |
virtual bool | encryptionEnabled () const |
Returns true if encryption is enabled. | |
virtual void | enableEncryption (bool enable) |
Enables/disables encryption globally. | |
virtual bool | keyLockEnabled () const |
Returns true if the key-lock is enabled. | |
virtual void | enableKeyLock (bool enable) |
Enable/disable key-lock. | |
virtual unsigned int | keyLockDelay () const |
Returns the key-lock delay in seconds. | |
virtual void | setKeyLockDelay (unsigned int sec) |
Sets the key-lock delay in seconds. | |
virtual bool | lockSideKey1 () const |
Retunrs true if the side-key 1 gets locked too. | |
virtual void | enableLockSideKey1 (bool enable) |
Enables/disables locking the side-key 1. | |
virtual bool | lockSideKey2 () const |
Retunrs true if the side-key 2 gets locked too. | |
virtual void | enableLockSideKey2 (bool enable) |
Enables/disables locking the side-key 2. | |
virtual bool | lockPTT () const |
Retunrs true if the PTT gets locked too. | |
virtual void | enableLockPTT (bool enable) |
Enables/disables locking the PTT. | |
virtual Language | language () const |
Returns the UI language. | |
virtual void | setLanguage (Language lang) |
Sets the UI language. | |
virtual SquelchMode | squelchMode () const |
Returns the squelch mode. | |
virtual void | setSquelchMode (SquelchMode mode) |
Sets the squelch mode. | |
virtual bool | rogerTonesEnabled () const |
Returns true , if the roger tones are enabled. | |
virtual void | enableRogerTones (bool enable) |
Enables/disables roger tones. | |
virtual bool | dmrCallOutToneEnabled () const |
Returns true if the DMR call out roger tone is enabled. | |
virtual void | enableDMRCallOutTone (bool enable) |
Enables/disables the DMR call out roger tone. | |
virtual bool | dmrVoiceEndToneEnabled () const |
Returns true if the DMR voice end roger tone is enabled. | |
virtual void | enableDMRVoiceEndTone (bool enable) |
Enables/disables the DMR voice end roger tone. | |
virtual bool | dmrCallEndToneEnabled () const |
Returns true if the DMR call end roger tone is enabled. | |
virtual void | enableDMRCallEndTone (bool enable) |
Enables/disables the DMR call end roger tone. | |
virtual bool | fmVoiceEndToneEnabled () const |
Returns true if the FM voice end roger tone is enabled. | |
virtual void | enableFMVoiceEndTone (bool enable) |
Enables/disables the FM voice end roger tone. | |
virtual bool | fmCallOutToneEnabled () const |
Returns true if the FM call out roger tone is enabled. | |
virtual void | enableFMCallOutTone (bool enable) |
Enables/disables the FM call out roger tone. | |
virtual bool | messageToneEnabled () const |
Returns true if the message tone is enabled. | |
virtual void | enableMessageTone (bool enable) |
Enables/disables message tone. | |
virtual RingTone | ringTone () const |
Retuns the ring tone. | |
virtual void | setRingTone (RingTone tone) |
Sets the ring tone. | |
virtual QString | radioName () const |
Retuns the radio name. | |
virtual void | setRadioName (const QString &name) |
Sets the radio name. | |
virtual float | reverseBurstFrequency () const |
Returns the reverse burst frequency in Hz. | |
virtual void | setReverseBurstFrequency (float Hz) |
Sets the reverse burst frequency in Hz. | |
virtual BacklightTime | backlightTime () const |
Returns the backlight time settings. | |
virtual void | setBacklightTime (BacklightTime time) |
Sets the backlight time. | |
virtual bool | campandingEnabled () const |
Returns true , if campanding is enabled. | |
virtual void | enableCampanding (bool enable) |
Enables/disables campanding. | |
virtual TuningMode | tunigModeUp () const |
Retunrs the tuning mode up-direction. | |
virtual void | setTuningModeUp (TuningMode mode) |
Sets the tuning mode up-direction. | |
virtual TuningMode | tunigModeDown () const |
Retunrs the tuning mode down-direction. | |
virtual void | setTuningModeDown (TuningMode mode) |
Sets the tuning mode down-direction. | |
virtual DisplayMode | displayMode () const |
Returns the display mode. | |
virtual void | setDisplayMode (DisplayMode mode) |
Sets the display mode. | |
virtual DualWatchMode | dualWatchMode () const |
Returns the dual-watch mode. | |
virtual void | setDualWatchMode (DualWatchMode mode) |
Sets the dual-watch mode. | |
virtual ScanMode | scanMode () const |
Returns the scan mode. | |
virtual void | setScanMode (ScanMode mode) |
Sets the scan mode. | |
virtual BootScreen | bootScreen () const |
Returns the boot-screen mode. | |
virtual void | setBootScreen (BootScreen mode) |
Sets the boot-screen mode. | |
virtual QString | bootLine1 () const |
Returns the boot-screen line 1. | |
virtual void | setBootLine1 (const QString &line) |
Sets the boot-screen line 1. | |
virtual QString | bootLine2 () const |
Returns the boot-screen line 2. | |
virtual void | setBootLine2 (const QString &line) |
Sets the boot-screen line 2. | |
virtual bool | ledEnabled () const |
Returns true if the LED is enabled. | |
virtual void | enableLED (bool enabled) |
Enables/disables the LED. | |
virtual unsigned int | loneWorkerResponseTime () const |
Returns the lone-worker response time in seconds. | |
virtual void | setLoneWorkerResponseTime (unsigned int sec) |
Sets the lone-worker response time in seconds. | |
virtual unsigned int | loneWorkerReminderTime () const |
Returns the lone-worker reminder time in seconds. | |
virtual void | setLoneWorkerReminderTime (unsigned int sec) |
Sets the lone-worker resminder time in seconds. | |
virtual bool | bootPasswordEnabled () const |
Returns true if the boot password is enabled. | |
virtual QString | bootPassword () const |
Returns the boot password. | |
virtual void | setBootPassword (const QString &passwd) |
Sets and enables boot password. | |
virtual void | clearBootPassword () |
Clears and disables boot password. | |
virtual bool | progPasswordEnabled () const |
Returns true if the programming password is enabled. | |
virtual QString | progPassword () const |
Returns the programming password. | |
virtual void | setProgPassword (const QString &passwd) |
Sets and enables programming password. | |
virtual void | clearProgPassword () |
Clears and disables programming password. | |
virtual bool | updateConfig (Config *config, const ErrorStack &err=ErrorStack()) |
Updates configuration. | |
virtual bool | fromConfig (Config *config, const ErrorStack &err=ErrorStack()) |
Encode from config. | |
Public Member Functions inherited from Codeplug::Element | |
Element (const Element &other) | |
Copy constructor. | |
virtual | ~Element () |
Destructor. | |
Element & | operator= (const Element &other) |
Copy assignment. | |
virtual bool | isValid () const |
Returns true if the pointer is not null. | |
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 () |
The size of the 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. | |
Implements the binary encoding of the settings element.
Memory representation of settings element (64h bytes):
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 | DMR ID, uint24, litte endian | 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 04 | 0x00 | 0x00 | 0x01 | 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 08 | Power save enable | Power save mode | VOX level 1-3 | 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0c | VOX delay, in 500ms | Encryption enable | Key-lock delay in sec. [1,90] | 0 0 0 0 0 |LS2|LS1|LPT| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 10 | Language | Squelch mode | 0x00 | Roger tone enable | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 14 | 0x00 | 0x01 | Ring tone [1,20], 0=off | Key lock enable | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 18 | Radio name, 16 x ASCII, 0-padded ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 24 ... | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 28 | 0 |MST|DCE|AVE|DVE|ACO|DCO| 1 | 0x00 | 0x00 | 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 2c | Reverse burst frequency 0.1 Hz, 0=off | 0x01 | Back-light time | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 30 | VOX enable | 0x00 | Campanding (?) enable | 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 34 | 0x00 | 0x00 | Up channel mode | Down channel mode | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 38 | 0x00 | 0x00 | 0x00 | 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 3c | Channel display | Dual stand-by mode | Scan mode | Boot screen | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 40 | Boot line 1, 8 x ASCII, 0-padded ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 44 ... | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 48 | Boot line 2, 8 x ASCII, 0-padded ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 4c ... | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 50 | LED enable | Lone worker response time 1s | 0 0 0 0 0 0 |BPE|PPE| Prog. password length | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 54 | Programming password, 6 x ASCII, 0-padded ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 58 ... | 0x00 | 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 5c | Lone worker reminder time 1s | Boot password length | Boot password, 6 x ASCII, 0-padded ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 60 ... | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ Where: - Power save mode: 0x01 = 50%, 0x02 = 25%, 0x03 = 12% - LS1: Lock side-key 1 - LS2: Lock side-key 2 - LPT: Lock PTT - Language: 0 = simplified Chinese, 1 = English - DCO: Digital call out roger tone - DVE: Digital voice end roger tone - DCE: Digital call end roger tone - ACO: Analog call out roger tone - AVE: Analog voice end roger tone - MST: Message tone - Back-light time: 0 = Infinite, 1 = Off, 2 = 5s, 3 = 10s - Squelch Mode: 0x00 = Normal, 0x01 = Silent - Up/down channel mode: 0=channel, 1=VFO - Channel display: 0 = Number, 1 = Name, 2 = Frequency - Dual stand-by mode: 0=off, 1 = double double, 2 = double single - Scan mode: 0=time, 1=carrier, 2=search - Boot screen: 0 = Picture, 1 = Text - BPE: Boot password enable - PPE: Programming password enable
|
virtual |
Abstract method to reset the element within the codeplug.
Any device specific element should implement this method.
Reimplemented from Codeplug::Element.
|
virtual |
Sets the power-save mode.
|
virtual |
Sets the VOX sensitivity [0,10].
0 means VOX off.
|
virtual |
Returns the VOX sensitivity [0,10].
0 means VOX off.