libdrmconf
0.9.0
A library to program DMR radios.
|
Represents the abstract base class of all codeplug elements. More...
#include <codeplug.hh>
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 | getBit (uint offset, uint bit) const |
Reads a specific bit at the given byte-offset. | |
void | setBit (uint offset, uint bit, bool value=true) |
Sets a specific bit at the given byte-offset. | |
void | clearBit (uint offset, uint bit) |
Clears a specific bit at the given byte-offset. | |
uint8_t | getUInt2 (uint offset, uint bit) const |
Reads a 2bit integer at the given byte- and bit-offset. | |
void | setUInt2 (uint offset, uint bit, uint8_t value) |
Stores a 2bit integer at the given byte- and bit-offset. | |
uint8_t | getUInt3 (uint offset, uint bit) const |
Reads a 3bit integer at the given byte- and bit-offset. | |
void | setUInt3 (uint offset, uint bit, uint8_t value) |
Stores a 3bit integer at the given byte- and bit-offset. | |
uint8_t | getUInt4 (uint offset, uint bit) const |
Reads a 4bit integer at the given byte- and bit-offset. | |
void | setUInt4 (uint offset, uint bit, uint8_t value) |
Stores a 4bit integer at the given byte- and bit-offset. | |
uint8_t | getUInt5 (uint offset, uint bit) const |
Reads a 5bit integer at the given byte- and bit-offset. | |
void | setUInt5 (uint offset, uint bit, uint8_t value) |
Stores a 5bit integer at the given byte- and bit-offset. | |
uint8_t | getUInt6 (uint offset, uint bit) const |
Reads a 6bit integer at the given byte- and bit-offset. | |
void | setUInt6 (uint offset, uint bit, uint8_t value) |
Stores a 6bit integer at the given byte- and bit-offset. | |
uint8_t | getUInt8 (uint offset) const |
Reads a 8bit integer at the given byte- and bit-offset. | |
void | setUInt8 (uint offset, uint8_t value) |
Reads a 8bit integer at the given byte- and bit-offset. | |
uint16_t | getUInt16_be (uint offset) const |
Reads a 16bit big-endian integer at the given byte-offset. | |
uint16_t | getUInt16_le (uint offset) const |
Reads a 16bit little-endian integer at the given byte-offset. | |
void | setUInt16_be (uint offset, uint16_t value) |
Stores a 16bit big-endian integer at the given byte-offset. | |
void | setUInt16_le (uint offset, uint16_t value) |
Stores a 16bit little-endian integer at the given byte-offset. | |
uint32_t | getUInt24_be (uint offset) const |
Reads a 24bit big-endian integer at the given byte-offset. | |
uint32_t | getUInt24_le (uint offset) const |
Reads a 24bit little-endian integer at the given byte-offset. | |
void | setUInt24_be (uint offset, uint32_t value) |
Stores a 24bit big-endian integer at the given byte-offset. | |
void | setUInt24_le (uint offset, uint32_t value) |
Stores a 24bit little-endian integer at the given byte-offset. | |
uint32_t | getUInt32_be (uint offset) const |
Reads a 32bit big-endian integer at the given byte-offset. | |
uint32_t | getUInt32_le (uint offset) const |
Reads a 32bit little-endian integer at the given byte-offset. | |
void | setUInt32_be (uint offset, uint32_t value) |
Stores a 32bit big-endian integer at the given byte-offset. | |
void | setUInt32_le (uint offset, uint32_t value) |
Stores a 32bit little-endian integer at the given byte-offset. | |
uint8_t | getBCD2 (uint offset) const |
Reads a 2-digit (1-byte/8bit) BDC value in big-endian at the given byte-offset. | |
void | setBCD2 (uint 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 (uint offset) const |
Reads a 4-digit (2-byte/16bit) BDC value in big-endian at the given byte-offset. | |
void | setBCD4_be (uint 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 (uint offset) const |
Reads a 4-digit (2-byte/16bit) BDC value in little-endian at the given byte-offset. | |
void | setBCD4_le (uint 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 (uint offset) const |
Reads a 8-digit (4-byte/32bit) BDC value in big-endian at the given byte-offset. | |
void | setBCD8_be (uint 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 (uint offset) const |
Reads a 8-digit (4-byte/32bit) BDC value in little-endian at the given byte-offset. | |
void | setBCD8_le (uint offset, uint32_t value) |
Stores a 8-digit (4-byte/32bit) BDC value in little-endian at the given byte-offset. | |
QString | readASCII (uint offset, uint maxlen, uint8_t eos=0x00) const |
Reads upto maxlen ASCII chars at the given byte-offset using eos as the string termination char. | |
void | writeASCII (uint offset, const QString &txt, uint maxlen, uint8_t eos=0x00) |
Stores upto maxlen ASCII chars at the given byte-offset using eos as the string termination char. More... | |
QString | readUnicode (uint offset, uint maxlen, uint16_t eos=0x0000) const |
Reads upto maxlen unicode chars at the given byte-offset using eos as the string termination char. | |
void | writeUnicode (uint offset, const QString &txt, uint maxlen, uint16_t eos=0x0000) |
Stores upto 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. | |
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 provies some helper methods to access specific members of the element.
|
protected |
Hidden constructor.
ptr | Specifies the pointer to the element within the codeplug. |
size | Specifies the size of the element in bytes. |
|
virtual |
Abstract method to reset the element within the codeplug.
Any device specific element should implement this method.
Reimplemented in TyTCodeplug::EncryptionElement, TyTCodeplug::EmergencySystemElement, TyTCodeplug::EmergencySettingsElement, TyTCodeplug::OneTouchSettingElement, TyTCodeplug::ButtonSettingsElement, TyTCodeplug::MenuSettingsElement, TyTCodeplug::GPSSystemElement, TyTCodeplug::TimestampElement, TyTCodeplug::BootSettingsElement, TyTCodeplug::GeneralSettingsElement, TyTCodeplug::ScanListElement, TyTCodeplug::GroupListElement, TyTCodeplug::ZoneExtElement, TyTCodeplug::ZoneElement, TyTCodeplug::ContactElement, TyTCodeplug::ChannelElement, TyTCallsignDB::EntryElement, TyTCallsignDB::IndexElement, and TyTCallsignDB::IndexElement::Entry.
void CodePlug::Element::writeASCII | ( | uint | offset, |
const QString & | txt, | ||
uint | maxlen, | ||
uint8_t | eos = 0x00 |
||
) |
Stores upto maxlen
ASCII chars at the given byte-offset using eos
as the string termination char.
The stored string gets padded with eos
to maxlen
.
void CodePlug::Element::writeUnicode | ( | uint | offset, |
const QString & | txt, | ||
uint | maxlen, | ||
uint16_t | eos = 0x0000 |
||
) |
Stores upto maxlen
unicode chars at the given byte-offset using eos
as the string termination char.
The stored string gets padded with eos
to maxlen
.