libdrmconf  0.11.3
A library to program DMR radios.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Codeplug::Element Class Reference

Represents the abstract base class of all codeplug elements. More...

#include <codeplug.hh>

Inherited by AnytoneCodeplug::AlarmSettingElement, AnytoneCodeplug::AlarmSettingElement::AnalogAlarm, AnytoneCodeplug::AlarmSettingElement::DigitalAlarm, AnytoneCodeplug::AnalogQuickCallElement, AnytoneCodeplug::AnalogQuickCallsElement, AnytoneCodeplug::BitmapElement, AnytoneCodeplug::BootSettingsElement, AnytoneCodeplug::ChannelElement, AnytoneCodeplug::ContactElement, AnytoneCodeplug::ContactMapElement, AnytoneCodeplug::DMRAPRSMessageElement, AnytoneCodeplug::DMRAPRSSettingsElement, AnytoneCodeplug::DMREncryptionKeyIDListElement, AnytoneCodeplug::DMREncryptionKeyListElement, AnytoneCodeplug::DTMFContactElement, AnytoneCodeplug::DTMFIDListElement, AnytoneCodeplug::DTMFSettingsElement, AnytoneCodeplug::DigitalAlarmExtensionElement, AnytoneCodeplug::ExtendedSettingsElement, AnytoneCodeplug::FiveToneFunctionElement, AnytoneCodeplug::FiveToneFunctionListElement, AnytoneCodeplug::FiveToneIDElement, AnytoneCodeplug::FiveToneIDListElement, AnytoneCodeplug::FiveToneSettingsElement, AnytoneCodeplug::GeneralSettingsElement, AnytoneCodeplug::GroupListElement, AnytoneCodeplug::HotKeyElement, AnytoneCodeplug::HotKeySettingsElement, AnytoneCodeplug::InvertedBitmapElement, AnytoneCodeplug::InvertedBytemapElement, AnytoneCodeplug::MessageElement, AnytoneCodeplug::MessageListElement, AnytoneCodeplug::RadioIDElement, AnytoneCodeplug::RepeaterOffsetListElement, AnytoneCodeplug::ScanListElement, AnytoneCodeplug::StatusMessagesElement, AnytoneCodeplug::TwoToneFunctionElement, AnytoneCodeplug::TwoToneIDElement, AnytoneCodeplug::TwoToneSettingsElement, AnytoneCodeplug::WFMChannelListElement, AnytoneCodeplug::WFMVFOElement, AnytoneCodeplug::ZoneChannelListElement, D868UVCallsignDB::EntryBankElement, D868UVCallsignDB::EntryElement, D868UVCallsignDB::IndexBankElement, D868UVCallsignDB::LimitsElement, D878UVCodeplug::AESEncryptionKeyElement, D878UVCodeplug::APRSSettingsElement, D878UVCodeplug::AnalogAPRSMessageElement, D878UVCodeplug::AnalogAPRSRXEntryElement, D878UVCodeplug::FMAPRSFrequencyNamesElement, D878UVCodeplug::RadioInfoElement, D878UVCodeplug::RoamingChannelElement, D878UVCodeplug::RoamingZoneElement, DM1701Codeplug::ZoneExtElement, DMR6X2UVCodeplug::APRSSettingsElement, OpenRTXCodeplug::ChannelElement, OpenRTXCodeplug::ContactElement, OpenRTXCodeplug::HeaderElement, OpenRTXCodeplug::ZoneElement [private], RadioddityCodeplug::BootSettingsElement, RadioddityCodeplug::BootTextElement, RadioddityCodeplug::ButtonSettingsElement, RadioddityCodeplug::ChannelBankElement, RadioddityCodeplug::ChannelElement, RadioddityCodeplug::ContactElement, RadioddityCodeplug::DTMFContactElement, RadioddityCodeplug::EncryptionElement, RadioddityCodeplug::GeneralSettingsElement, RadioddityCodeplug::GroupListBankElement, RadioddityCodeplug::GroupListElement, RadioddityCodeplug::MenuSettingsElement, RadioddityCodeplug::MessageBankElement, RadioddityCodeplug::ScanListBankElement, RadioddityCodeplug::ScanListElement, RadioddityCodeplug::ZoneBankElement, RadioddityCodeplug::ZoneElement, TyTCallsignDB::EntryElement, TyTCallsignDB::IndexElement, TyTCallsignDB::IndexElement::Entry, TyTCodeplug::ButtonSettingsElement, TyTCodeplug::ChannelElement, TyTCodeplug::ContactElement, TyTCodeplug::EmergencySettingsElement, TyTCodeplug::EmergencySystemElement, TyTCodeplug::EncryptionElement, TyTCodeplug::GPSSystemElement, TyTCodeplug::GeneralSettingsElement, TyTCodeplug::GroupListElement, TyTCodeplug::MenuSettingsElement, TyTCodeplug::OneTouchSettingElement, TyTCodeplug::ScanListElement, TyTCodeplug::TimestampElement, TyTCodeplug::ZoneElement, and UV390Codeplug::BootSettingsElement.

Public Member Functions

 Element (const Element &other)
 Copy constructor.
 
virtual ~Element ()
 Destructor.
 
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 (unsigned offset, unsigned bit) const
 Reads 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...
 

Protected Member Functions

 Element (uint8_t *ptr, size_t size)
 Hidden constructor. More...
 

Protected Attributes

uint8_t * _data
 Holds the pointer to the element.
 
size_t _size
 Holds the size of the element.
 

Detailed Description

Represents the abstract base class of all codeplug elements.

That is a memory region within the codeplug that encodes a specific element. E.g., channels, contacts, zones, etc. This class provides some helper methods to access specific members of the element.

Since
0.9.0

Constructor & Destructor Documentation

◆ Element()

Codeplug::Element::Element ( uint8_t *  ptr,
size_t  size 
)
protected

Hidden constructor.

Parameters
ptrSpecifies the pointer to the element within the codeplug.
sizeSpecifies the size of the element in bytes.

Member Function Documentation

◆ clear()

void Codeplug::Element::clear ( )
virtual

Abstract method to reset the element within the codeplug.

Any device specific element should implement this method.

Reimplemented in UV390Codeplug::MenuSettingsElement, UV390Codeplug::BootSettingsElement, UV390Codeplug::GeneralSettingsElement, UV390Codeplug::ChannelElement, TyTCodeplug::EncryptionElement, TyTCodeplug::EmergencySystemElement, TyTCodeplug::EmergencySettingsElement, TyTCodeplug::OneTouchSettingElement, TyTCodeplug::ButtonSettingsElement, TyTCodeplug::MenuSettingsElement, TyTCodeplug::GPSSystemElement, TyTCodeplug::TimestampElement, TyTCodeplug::GeneralSettingsElement, TyTCodeplug::ScanListElement, TyTCodeplug::GroupListElement, TyTCodeplug::ZoneElement, TyTCodeplug::ContactElement, TyTCodeplug::ChannelElement, TyTCallsignDB::EntryElement, TyTCallsignDB::IndexElement, TyTCallsignDB::IndexElement::Entry, RD5RCodeplug::ChannelElement, RadioddityCodeplug::EncryptionElement, RadioddityCodeplug::MessageBankElement, RadioddityCodeplug::BootTextElement, RadioddityCodeplug::BootSettingsElement, RadioddityCodeplug::MenuSettingsElement, RadioddityCodeplug::ButtonSettingsElement, RadioddityCodeplug::GeneralSettingsElement, RadioddityCodeplug::ScanListBankElement, RadioddityCodeplug::ScanListElement, RadioddityCodeplug::GroupListBankElement, RadioddityCodeplug::GroupListElement, RadioddityCodeplug::ZoneBankElement, RadioddityCodeplug::ZoneElement, RadioddityCodeplug::DTMFContactElement, RadioddityCodeplug::ContactElement, RadioddityCodeplug::VFOChannelElement, RadioddityCodeplug::ChannelBankElement, RadioddityCodeplug::ChannelElement, OpenRTXCodeplug::ZoneElement, OpenRTXCodeplug::ContactElement, OpenRTXCodeplug::ChannelElement, OpenRTXCodeplug::HeaderElement, OpenGD77Codeplug::ContactElement, OpenGD77Codeplug::ZoneElement, OpenGD77Codeplug::ChannelElement, MD390Codeplug::MenuSettingsElement, MD390Codeplug::ChannelElement, GD77Codeplug::ScanListBankElement, GD77Codeplug::ScanListElement, GD77Codeplug::ContactElement, GD77Codeplug::ChannelElement, DMR6X2UVCodeplug::APRSSettingsElement, DMR6X2UVCodeplug::ExtendedSettingsElement, DM1701Codeplug::ZoneExtElement, DM1701Codeplug::ButtonSettingsElement, DM1701Codeplug::GeneralSettingsElement, DM1701Codeplug::ChannelElement, D878UVCodeplug::RadioInfoElement, D878UVCodeplug::AESEncryptionKeyElement, D878UVCodeplug::RoamingZoneElement, D878UVCodeplug::RoamingChannelElement, D878UVCodeplug::AnalogAPRSRXEntryElement, D878UVCodeplug::AnalogAPRSMessageElement, D878UVCodeplug::APRSSettingsElement, D878UVCodeplug::FMAPRSFrequencyNamesElement, D878UVCodeplug::ExtendedSettingsElement, D878UVCodeplug::GeneralSettingsElement, D878UVCodeplug::ChannelElement, D868UVCodeplug::GeneralSettingsElement, D868UVCallsignDB::LimitsElement, D868UVCallsignDB::IndexBankElement, D868UVCallsignDB::EntryBankElement, D868UVCallsignDB::EntryElement, AnytoneCodeplug::ContactMapElement, AnytoneCodeplug::DMREncryptionKeyListElement, AnytoneCodeplug::DMREncryptionKeyIDListElement, AnytoneCodeplug::WFMVFOElement, AnytoneCodeplug::WFMChannelListElement, AnytoneCodeplug::DTMFIDListElement, AnytoneCodeplug::DTMFSettingsElement, AnytoneCodeplug::TwoToneSettingsElement, AnytoneCodeplug::TwoToneFunctionElement, AnytoneCodeplug::TwoToneIDElement, AnytoneCodeplug::FiveToneSettingsElement, AnytoneCodeplug::FiveToneFunctionListElement, AnytoneCodeplug::FiveToneFunctionElement, AnytoneCodeplug::FiveToneIDListElement, AnytoneCodeplug::FiveToneIDElement, AnytoneCodeplug::DigitalAlarmExtensionElement, AnytoneCodeplug::AlarmSettingElement, AnytoneCodeplug::AlarmSettingElement::DigitalAlarm, AnytoneCodeplug::AlarmSettingElement::AnalogAlarm, AnytoneCodeplug::HotKeySettingsElement, AnytoneCodeplug::HotKeyElement, AnytoneCodeplug::StatusMessagesElement, AnytoneCodeplug::AnalogQuickCallsElement, AnytoneCodeplug::AnalogQuickCallElement, AnytoneCodeplug::MessageElement, AnytoneCodeplug::MessageListElement, AnytoneCodeplug::RepeaterOffsetListElement, AnytoneCodeplug::DMRAPRSMessageElement, AnytoneCodeplug::DMRAPRSSettingsElement, AnytoneCodeplug::BootSettingsElement, AnytoneCodeplug::ZoneChannelListElement, AnytoneCodeplug::GeneralSettingsElement, AnytoneCodeplug::RadioIDElement, AnytoneCodeplug::ScanListElement, AnytoneCodeplug::GroupListElement, AnytoneCodeplug::DTMFContactElement, AnytoneCodeplug::ContactElement, AnytoneCodeplug::ChannelElement, AnytoneCodeplug::InvertedBytemapElement, AnytoneCodeplug::InvertedBitmapElement, and AnytoneCodeplug::BitmapElement.

◆ writeASCII()

void Codeplug::Element::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.

The stored string gets padded with eos to maxlen.

◆ writeUnicode()

void Codeplug::Element::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.

The stored string gets padded with eos to maxlen.


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