libdrmconf
0.12.0
A library to program DMR radios.
|
Implements the binary encoding of the channels settings. More...
#include <dr1801uv_codeplug.hh>
Classes | |
struct | Offset |
Some offsets within the codeplug. More... | |
Public Types | |
enum class | Type { FM = 1 , DMR = 3 } |
Possible channel types. | |
enum class | Power { Low = 0 , High = 1 } |
Possible power settings. | |
enum class | Admit { Always = 0 , ColorCode_or_Tone = 1 , ChannelFree = 2 } |
Possible values for the admid criterion. | |
enum class | TimeSlot { TS1 = 1 , TS2 = 2 } |
Possible time-slot values. | |
enum class | SignalingMode { None = 0 , DTMF = 1 } |
Possible FM signaling modes. | |
enum class | Bandwidth { Narrow = 1 , Wide = 2 } |
Possible band width settings. | |
enum class | SubToneType { None = 0 , CTCSS = 1 , DCS = 2 } |
Possible subtone types. | |
enum class | DCSMode { Normal = 0 , Inverted = 1 } |
Possible DCS modes. | |
Public Member Functions | |
ChannelElement (uint8_t *ptr) | |
Constructor from pointer. | |
bool | isValid () const |
Returns true if the pointer is not null. | |
void | clear () |
Abstract method to reset the element within the codeplug. More... | |
virtual unsigned int | index () const |
Retunrs the 0-based index of the channel. | |
virtual void | setIndex (unsigned int idx) |
Sets the index. | |
virtual Type | channelType () const |
Returns the channel type. | |
virtual void | setChannelType (Type type) |
Sets the channel type. | |
virtual Channel::Power | power () const |
Returns the power settings of the channel. | |
virtual void | setPower (Channel::Power pwr) |
Sets the power for the channel. | |
virtual Frequency | rxFrequency () const |
Retunrs the RX frequency in MHz. | |
virtual void | setRXFrequency (Frequency MHz) |
Sets the RX frequency in MHz. | |
virtual Frequency | txFrequency () const |
Retunrs the TX frequency in MHz. | |
virtual void | setTXFrequency (Frequency MHz) |
Sets the TX frequency in MHz. | |
virtual bool | hasTransmitContact () const |
Returns true if a contact index is set. | |
virtual unsigned int | transmitContactIndex () const |
Retunrs the contact index. | |
virtual void | setTransmitContactIndex (unsigned int index) |
Sets the transmit contact index. | |
virtual void | clearTransmitContactIndex () |
Clears the contact index. | |
virtual Admit | admitCriterion () const |
Returns the admit criterion. | |
virtual void | setAdmitCriterion (Admit admit) |
Sets the admit criterion. | |
virtual unsigned int | colorCode () const |
Returns the color code (0-15). | |
virtual void | setColorCode (unsigned int cc) |
Sets the color code (0-15). | |
virtual DMRChannel::TimeSlot | timeSlot () const |
Returns the time slot. | |
virtual void | setTimeSlot (DMRChannel::TimeSlot ts) |
Sets the time slot. | |
virtual bool | hasEncryptionKey () const |
Returns true if an ecryption key index is set. | |
virtual unsigned int | encryptionKeyIndex () const |
Returns the encryption key index. | |
virtual void | setEncryptionKeyIndex (unsigned int index) |
Sets the encryption key index. | |
virtual void | clearEncryptionKeyIndex () |
Clears the encryption key index. | |
virtual bool | dcdm () const |
Returns true if dual-capacity direct mode is enabled. | |
virtual void | enableDCDM (bool enable) |
Enables/disables dual-capacity direct mode. | |
virtual bool | confirmPrivateCall () const |
Returns true if private-call confirmation is enabled. | |
virtual void | enablePrivateCallConfirmation (bool enable) |
Enables/disables private-call confirmation. | |
virtual SignalingMode | signalingMode () const |
Returns the FM signaling mode. | |
virtual void | setSignalingMode (SignalingMode mode) |
Sets the FM signaling mode. | |
virtual bool | hasAlarmSystem () const |
Returns true if the alarm system index is set. | |
virtual unsigned int | alarmSystemIndex () const |
Returns the index of the alarm system. | |
virtual void | setAlarmSystemIndex (unsigned int index) |
Sets the alarm system index. | |
virtual void | clearAlarmSystemIndex () |
Clears the alarm system index. | |
virtual FMChannel::Bandwidth | bandwidth () const |
Retunrs the band width for FM channels. | |
virtual void | setBandwidth (FMChannel::Bandwidth bw) |
Sets the band width for FM channels. | |
virtual bool | autoScanEnabled () const |
Retunrs true , if the auto-scan is enabled. | |
virtual void | enableAutoScan (bool enable) |
Enables/disables auto-scan. | |
virtual bool | hasScanList () const |
Retunrs true if a scan list is assigned. | |
virtual unsigned int | scanListIndex () const |
Returns the scan list index. | |
virtual void | setScanListIndex (unsigned int index) |
Sets the scan list index. | |
virtual void | clearScanListIndex () |
Clears the scan list index. | |
virtual Signaling::Code | rxTone () const |
Retunrs the RX CTCSS/DCS signaling. | |
virtual void | setRXTone (Signaling::Code code) |
Sets the RX CTCSS/DCS signaling. | |
virtual Signaling::Code | txTone () const |
Retunrs the TX CTCSS/DCS signaling. | |
virtual void | setTXTone (Signaling::Code code) |
Sets the TX CTCSS/DCS signaling. | |
virtual bool | talkaround () const |
Returns true if talkaround is enabled. | |
virtual void | enableTalkaround (bool enable) |
Enables/disables talkaround. | |
virtual bool | hasPTTID () const |
Returns true if a PTT ID is set. | |
virtual unsigned int | pttIDIndex () const |
Returns the PTT-ID index. | |
virtual void | setPTTIDIndex (unsigned int idx) |
Sets the PTT-ID index. | |
virtual void | clearPTTID () |
Clears the PTT ID. | |
virtual bool | hasGroupList () const |
Retruns true if a group list is assigned. | |
virtual unsigned int | groupListIndex () const |
Retunrs the group-list index. | |
virtual void | setGroupListIndex (unsigned int index) |
Sets the group-list index. | |
virtual void | clearGroupListIndex () |
Clears the group list index. | |
virtual bool | loneWorker () const |
Returns true if lone-worker is enabled. | |
virtual void | enableLoneWorker (bool enable) |
Enables/disables lone-worker. | |
virtual Channel * | toChannelObj (Context &ctx, const ErrorStack &err=ErrorStack()) const |
Constructs a channel object. | |
virtual bool | linkChannelObj (Channel *channel, Context &ctx, const ErrorStack &err=ErrorStack()) const |
Links the channel object. | |
virtual bool | encode (Channel *channel, Context &ctx, const ErrorStack &err=ErrorStack()) |
Encodes the given channel. | |
Public Member Functions inherited from Codeplug::Element | |
Element (const Element &other) | |
Copy constructor. | |
virtual | ~Element () |
Destructor. | |
Element & | operator= (const Element &other) |
Copy assignment. | |
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 element. | |
Protected Member Functions | |
ChannelElement (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 channels settings.
Memory representation of the channel settings (0034h 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 | Index, uint16, litte endian, 0xffff invalid | Type, 0x01=FM, 0x03=DMR | Power 0x00=low, 0x01=high | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 04 | RX frequency in Hz, uint32, little endian | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 08 | TX frequency in Hz, uint32, little endian | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0c | Contact index+1, uint16, little endian, 0=none | Admit criterion | 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 10 | Color code | Time-slot, 1=TS1, 2=TS2 | 0x00 | 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 14 | Encryption key index+1, 0=off | 0 0 0 0 0 0 |DCD|PCC| FM signaling | 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 18 | Alarm sys index+1, 0=none | Bandwidth 0x01=12.5, 0x02=25 | Auto-scan enable | Scan list index+1, 0=none | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 1c | RX CTCSS Freq in 0.1Hz/DCS code | RX sub-tone type | RX DCS inverted | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 20 | TX CTCSS Freq in 0.1Hz/DCS code | TX sub-tone type | TX DCS inverted | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 24 | 0x00 |TKA| 0 0 0 0 0 0 0 | Unused set to 0x0000 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 28 | PTT ID index+1, 0=none | | Group List index+1, 0=None | Unused filled with 0x00 ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 2c ... | Lone worker 0x00=off, 0x01=on | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 30 | Unused, filled with 0x00 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ Where: - Admit criterion: 0x00=Always, 0x01 = Same CC/CTCSS, 0x02 = Channel Free - DCD: DCDM enable - PCC: Private call confirm - Sub-tone type: 0=None, 1=CTCSS, 2=DCS - FM Signaling: 0=none, 1=DTMF - TKA: Enable talk around.
|
virtual |
Abstract method to reset the element within the codeplug.
Any device specific element should implement this method.
Reimplemented from Codeplug::Element.