libdrmconf
0.12.0
A library to program DMR radios.
|
Implements an FM/DMR channel. More...
#include <gd73_codeplug.hh>
Classes | |
struct | Limit |
Some limits for the channel. More... | |
struct | Offset |
Internal used offsets within the element. More... | |
Public Types | |
enum class | Type { FM = 0 , DMR = 1 } |
Possible channel types. | |
enum class | Admit { Always = 0 , CC_CTCSS = 1 , Free =2 } |
Possible admit criteria. | |
Public Member Functions | |
ChannelElement (uint8_t *ptr) | |
Constructor. | |
QString | name () const |
Returns the name of the channel. | |
void | setName (const QString &name) |
Sets the channel name. | |
FMChannel::Bandwidth | bandwidth () const |
Returns the bandwidth of the channel. | |
void | setBandwidth (FMChannel::Bandwidth bandwidth) |
Sets the bandwidth. | |
bool | hasScanListIndex () const |
Returns true , if a scan list index is set. | |
unsigned int | scanListIndex () const |
Returns the index of the scan list. | |
void | setScanListIndex (unsigned int idx) |
Sets the scan list index. | |
void | clearScanListIndex () |
Clears the scan list index. | |
Type | type () const |
Returns the channel type. | |
void | setType (Type type) |
Sets the channel type. | |
bool | talkaroundEnabled () const |
Returns true if talkaround is enabled. | |
void | enableTalkaround (bool enable) |
Enable/disable talkaround. | |
bool | rxOnly () const |
Returns true if RX only is enabled. | |
void | enableRXOnly (bool enable) |
Enables/disables RX only. | |
bool | scanAutoStartEnabled () const |
Returns true if scan auto-start is enabled. | |
void | enableScanAutoStart (bool enable) |
Enables/disables scan auto-start. | |
Frequency | rxFrequency () const |
Returns the RX frequency. | |
void | setRXFrequency (const Frequency &f) |
Sets the RX frequency. | |
Frequency | txFrequency () const |
Returns the TX frequency. | |
void | setTXFrequency (const Frequency &f) |
Sets the TX frequency. | |
bool | hasDTMFPTTSettingsIndex () const |
Returns true if channel has DTMF PTT settings index. | |
unsigned int | dtmfPTTSettingsIndex () const |
Returns the DTMF PTT settings index. | |
void | setDTMFPTTSettingsIndex (unsigned int idx) |
Sets the DTMF PTT settings index. | |
void | clearDTMFPTTSettingsIndex () |
Resets the DTMF PTT settings index. | |
Channel::Power | power () const |
Returns the power setting. | |
void | setPower (Channel::Power power) |
Sets the power. | |
Admit | admit () const |
Returns the admit criterion. | |
void | setAdmit (Admit admit) |
Sets the admit criterion. | |
Signaling::Code | rxTone () const |
Returns the RX tone. | |
void | setRXTone (Signaling::Code code) |
Sets the RX tone. | |
Signaling::Code | txTone () const |
Returns the TX tone. | |
void | setTXTone (Signaling::Code code) |
Sets the TX tone. | |
DMRChannel::TimeSlot | timeSlot () const |
Returns the time slot. | |
void | setTimeSlot (DMRChannel::TimeSlot ts) |
Sets the time slot. | |
unsigned int | colorCode () const |
Returns the color code. | |
void | setColorCode (unsigned int cc) |
Sets the color code. | |
bool | groupListMatchesContact () const |
Returns true , if group list matches current TX contact. | |
bool | groupListAllMatch () const |
Returns true , if no group list match is needed (monitor). | |
unsigned int | groupListIndex () const |
Returns the group list index. | |
void | setGroupListIndex (unsigned int idx) |
Sets the group list index. | |
void | setGroupListAllMatch () |
Enables, that no group list match is needed (monitor). | |
void | setGroupListMatchesContact () |
Enables, that the group list matches the current TX contact. | |
bool | hasTXContact () const |
Returns true , if the transmit contact is set. | |
unsigned int | txContactIndex () const |
Returns the tx contact index. | |
void | setTXContactIndex (unsigned int idx) |
Sets the transmit contact index. | |
void | clearTXContactIndex () |
Clears the transmit contact index. | |
bool | hasEmergencySystemIndex () const |
Returns true if an emergency system index is set. | |
unsigned int | emergencySystemIndex () const |
Returns the emergency system index. | |
void | setEmergencySystemIndex (unsigned int idx) |
Sets the emergency system index. | |
void | clearEmergencySystemIndex () |
Clears the emergency system index. | |
bool | hasEncryptionKeyIndex () const |
Returns true if an encryption key index is set. | |
unsigned int | encryptionKeyIndex () const |
Returns the encryption key index. | |
void | setEncryptionKeyIndex (unsigned int idx) |
Sets the encryption key index. | |
void | clearEncryptionKeyIndex () |
Clears the encryption key index. | |
Channel * | toChannel (Context &ctx, const ErrorStack &err=ErrorStack()) |
Decodes the channel. | |
bool | linkChannel (Channel *ch, Context &ctx, const ErrorStack &err=ErrorStack()) |
Links decoded channel. | |
bool | encode (Channel *ch, Context &ctx, const ErrorStack &err=ErrorStack()) |
Encodes the given channel. | |
![]() | |
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. | |
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 channel element. | |
Protected Member Functions | |
ChannelElement (uint8_t *ptr, size_t size) | |
Hidden constructor. | |
![]() | |
Element (uint8_t *ptr, size_t size) | |
Hidden constructor. More... | |
Additional Inherited Members | |
![]() | |
uint8_t * | _data |
Holds the pointer to the element. | |
size_t | _size |
Holds the size of the element. | |
Implements an FM/DMR channel.
Memory representaion of the channel (size ):
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 | Name, 16 x 16bit unicode, litte endian, 0-padded ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 1c ... | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 20 | Bandwidth | Scan list index+1 | Channel type | Enable talkaround | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 24 | Enable RX only | Unknown 0x01 | Enable scan auto-start | RX frequency ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 28 ... | TX frequency ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 2c ... | DTMF PTT setting index+1 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 30 | Power | Admit criterion | Unknown 0x00 | Unknown 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 34 | RX tone mode | RX CTCSS frequency | RX DCS code | TX tone mode | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 38 | TX CTCSS frequency | TX DCS code | Unknown 0x00 | Unknown 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 3c | Timeslot | Color code [0-15] | Group list index+2 | Unknown 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 40 | TX contact index+1, 16bit unsiged int, little endian | Emergency system index+1 | Unknown 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 44 | Encryption key index+1 | Unknown 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ Where: - Bandwidth: 0=12.5kHz, 1=25kHz - Channel type: 0=FM, 1=DMR - RX/TX frequency in Hz, 32bit unsigned int, little endian - Power: 0=Low, 1=High - Admit criterion: 0=Always, 1=Color code/CTCSS, 2=Free - RX/TX tone mode: 0=None, 1=CTCSS, 2=DCS, 3=DCS inverted - RX/TX CTCSS frequency: 62.5Hz, 67.0Hz, 69.3Hz, 71.9Hz, 74.4Hz, 77.0Hz, 79.7Hz, 82.5Hz, 85.4Hz, 88.5Hz, 91.5Hz, 94.8Hz, 97.4Hz, 100.0Hz, 103.5Hz, 107.2Hz, 110.9Hz, 114.8Hz, 118.8Hz, 123.0Hz, 127.3Hz, 131.8Hz, 136.5Hz, 141.3Hz, 146.2Hz, 151.4Hz, 156.7Hz, 159.8Hz, 162.2Hz, 165.5Hz, 167.9Hz, 171.3Hz, 173.8Hz, 177.3Hz, 179.9Hz, 183.5Hz, 186.2Hz, 189.9Hz, 192.8Hz, 196.6Hz, 199.5Hz, 203.5Hz, 206.5Hz, 210.7Hz, 218.1Hz, 225.7Hz, 229.1Hz, 233.6Hz, 241.8Hz, 250.3Hz, 254.1Hz - RX/TX DCS code: 23, 25, 26, 31, 32, 36, 43, 47, 51, 53, 54, 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131, 132, 134, 143, 145, 152, 155, 156, 162, 165, 172, 174, 205, 212, 223, 225, 226, 243, 244, 245, 246, 251, 252, 255, 261, 263, 265, 266, 271, 274, 306, 311, 315, 325, 331, 332, 343, 346, 351, 356, 364, 365, 371, 411, 412, 413, 423, 431, 432, 445, 446, 452, 454, 455, 462, 464, 465, 466, 503, 506, 516, 523, 526, 532, 546, 565, 606, 612, 624, 627, 631, 632, 645, 654, 662, 703, 712, 723, 731, 732, 734, 743, 754 - Timeslot: 0=TS1, 1=TS2, 2=DCDM-TS1, 3=DCDM-TS2 - Group list index: 0=current, 1=no-match, index+2 otherwise.