libdrmconf
0.12.0
A library to program DMR radios.
|
Implements the binary representation of a channel. More...
#include <openrtx_codeplug.hh>
Public Types | |
enum | Bandwidth { BW_12_5kHz = 0 , BW_20kHz = 1 , BW_25kHz = 2 } |
Specifies the possible bandwidth settings. | |
enum | Timeslot { Timeslot1 = 1 , Timeslot2 = 2 } |
Specifies the DMR time slot settings. | |
enum | ChannelMode { M17Voice = 1 , M17Data = 2 , M17VoiceData = 3 } |
Specifies the M17 channel mode. | |
enum | EncryptionMode { EncrNone = 0 , EncrAES256 = 1 , EncrScrambler = 2 } |
Specifies the M17 encryption modes. | |
Public Member Functions | |
ChannelElement (uint8_t *ptr) | |
Constructs a channel from the given memory. | |
virtual | ~ChannelElement () |
Destructor. | |
bool | isValid () const |
Returns true if the pointer is not null. | |
virtual void | clear () |
Resets the channel. | |
virtual Mode | mode () const |
Returns the channel mode. | |
virtual void | setMode (Mode mode) |
Sets the channel mode. | |
virtual bool | rxOnly () const |
Returns true , if the channel is RX only. | |
virtual void | setRXOnly (bool enable) |
Enables/disables RX only for the channel. | |
virtual Bandwidth | bandwidth () const |
Returns the bandwidth of the channel. | |
virtual void | setBandwidth (Bandwidth bw) |
Sets the bandwidth of the channel. | |
virtual float | power () const |
Power in dBm. | |
virtual void | setPower (float dBm) |
Set power in dBm. | |
virtual Frequency | rxFrequency () const |
Returns the RX frequency in MHz. | |
virtual void | setRXFrequency (Frequency MHz) |
Sets the RX frequency in MHz. | |
virtual Frequency | txFrequency () const |
Returns the TX frequency in MHz. | |
virtual void | setTXFrequency (Frequency MHz) |
Sets the TX frequency in MHz. | |
virtual bool | hasScanListIndex () const |
Retrusn true if the scan list is set. | |
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 bool | hasGroupListIndex () const |
Retrusn true if the group list is set. | |
virtual unsigned int | groupListIndex () const |
Returns the group list index. | |
virtual void | setGroupListIndex (unsigned int index) |
Sets the group list index. | |
virtual void | clearGroupListIndex () |
Clears the group list index. | |
virtual QString | name () const |
Returns the channel name. | |
virtual void | setName (const QString &name) |
Sets the channel name. | |
virtual QString | description () const |
Returns the channel description. | |
virtual void | setDescription (const QString &description) |
Sets the channel description. | |
virtual float | latitude () const |
Returns the channel latitude. | |
virtual void | setLatitude (float lat) |
Sets the latitude. | |
virtual float | longitude () const |
Returns the channel longitude. | |
virtual void | setLongitude (float lat) |
Sets the longitude. | |
virtual unsigned int | altitude () const |
Returns the height in meters. | |
virtual void | setAltitude (unsigned int alt) |
Sets the height in meters. | |
virtual Signaling::Code | rxTone () const |
Returns the CTCSS RX sub-tone. More... | |
virtual void | setRXTone (Signaling::Code code, const ErrorStack &err=ErrorStack()) |
Sets the CTCSS RX sub-tone. More... | |
virtual Signaling::Code | txTone () const |
Returns the CTCSS TX sub-tone. More... | |
virtual void | setTXTone (Signaling::Code code, const ErrorStack &err=ErrorStack()) |
Sets the CTCSS TX sub-tone. More... | |
virtual unsigned int | rxColorCode () const |
Returns the RX color code. More... | |
virtual void | setRXColorCode (unsigned int cc) |
Sets the RX color code. More... | |
virtual unsigned int | txColorCode () const |
Returns the TX color code. More... | |
virtual void | setTXColorCode (unsigned int cc) |
Sets the TX color code. More... | |
virtual DMRChannel::TimeSlot | timeslot () const |
Returns the times slot for the channel. More... | |
virtual void | setTimeslot (DMRChannel::TimeSlot ts) |
Sets the timeslot for the channel. More... | |
virtual bool | hasDMRContactIndex () const |
Returns true if the DMR contact index is set. | |
virtual unsigned int | dmrContactIndex () const |
Returns the contact index for the DMR contact. More... | |
virtual void | setDMRContactIndex (unsigned int idx) |
Sets the DMR contact index. More... | |
virtual void | clearDMRContactIndex () |
Clears the DMR contact index. | |
virtual unsigned int | rxChannelAccessNumber () const |
Returns the RX channel access number. More... | |
virtual void | setRXChannelAccessNumber (unsigned int cc) |
Sets the RX channel access number. More... | |
virtual unsigned int | txChannelAccessNumber () const |
Returns the TX color code. More... | |
virtual void | setTXChannelAccessNumber (unsigned int cc) |
Sets the TX color code. More... | |
virtual EncryptionMode | encryptionMode () const |
Returns the encryption mode of the channel. More... | |
virtual void | setEncryptionMode (EncryptionMode mode) |
Sets the encryption mode for the channel. More... | |
virtual ChannelMode | channelMode () const |
Returns the channel mode. More... | |
virtual void | setChannelMode (ChannelMode mode) |
Sets the channel mode. More... | |
virtual bool | gpsDataEnabled () const |
Returns true if GPS position is sent as meta-data. More... | |
virtual void | enableGPSData (bool enable) |
Enables/disables sending of GPS position as meta-data. More... | |
virtual bool | hasM17ContactIndex () const |
Returns true if the M17 contact index is set. | |
virtual unsigned int | m17ContactIndex () const |
Returns the M17 contact index. More... | |
virtual void | setM17ContactIndex (unsigned int idx) |
Sets the M17 contact index. More... | |
virtual void | clearM17ContactIndex () |
Clears the M17 contact index. | |
virtual Channel * | toChannelObj (Context &ctx, const ErrorStack &err=ErrorStack()) const |
Constructs a generic Channel object from the codeplug channel. | |
virtual bool | linkChannelObj (Channel *c, Context &ctx, const ErrorStack &err=ErrorStack()) const |
Links a previously constructed channel to the rest of the configuration. | |
virtual bool | fromChannelObj (const Channel *c, Context &ctx, const ErrorStack &err=ErrorStack()) |
Initializes this codeplug channel from the given generic configuration. | |
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... | |
Protected Types | |
enum | Offsets { OffsetMode = 0x00 , OffsetBandwidth = 0x01 , BitBandwidth = 0x00 , OffsetRXOnly = 0x01 , BitRXOnly = 0x02 , OffsetPower = 0x02 , OffsetRXFrequency = 0x03 , OffsetTXFrequency = 0x07 , OffsetScanList = 0x0b , OffsetGroupList = 0x0c , OffsetName = 0x0d , OffsetDescription = 0x2d , OffsetChLatInt = 0x4d , OffsetChLatDec = 0x4e , OffsetChLonInt = 0x50 , OffsetChLonDec = 0x51 , OffsetChAltitude = 0x53 , OffsetRXTone = 0x55 , OffsetTXTone = 0x56 , OffsetRXColorCode = 0x55 , BitRXColorCode = 0x00 , OffsetTXColorCode = 0x55 , BitTXColorCode = 0x04 , OffsetTimeSlot = 0x56 , OffsetDMRContact = 0x57 , OffsetRXCAN = 0x55 , BitRXCAN = 0x00 , OffsetTXCAN = 0x55 , BitTXCAN = 0x04 , OffsetEncrMode = 0x56 , BitEncrMode = 0x04 , OffsetM17ChMode = 0x56 , BitM17ChMode = 0x00 , OffsetM17GPSMode = 0x57 , OffsetM17Contact = 0x58 , StringLength = 0x20 } |
Just contains the offsets within the channel element. | |
Protected Member Functions | |
ChannelElement (uint8_t *ptr, size_t size) | |
Constructs a channel from the given memory. | |
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 representation of a channel.
Binary representation (size 005ah 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 | Channel Mode |Unused set to 0 |RXO| BandW | Power 10dBm + n*0.2 | RX Frequency in Hz, little ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 04 ... endian | TX Frequency in Hz, little ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 08 ... endian | Scan list index +1, 0=None | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0c | Group list index +1, 0=None | Name, 32 x ASCII, 0-padded ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 2c ... | Description, 32 x ASCII, 0-padded ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 4c ... | Ch. lat. int. part, signed | Ch. lat. decimal part, little endian | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 50 | Ch. lon. int. part, signed | Ch. lon. decimal part, little endian | Ch. alt. meters, little ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 54 ... endian | Mode specific settings 5 bytes see below ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 58 ... | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ Channel Mode: 0=FM, 1=DMR, 2=M17 BandW: Bandwidth, ?? RXO: RX only FM settings 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 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 55 | CTCSS RX tone idx |RTE| CTCSS TX tone idx |TTE| Unused, set to 0 ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 59 ... | +---+---+---+---+---+---+---+---+ RTE: RX Tone enable TTE: TX Tone enable DMR settings 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 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 55 | TX color code | RX color code | Time slot 1,2 | Contact index, little endian | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 59 | Unused, set to 0 | +---+---+---+---+---+---+---+---+ M17 settings 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 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 55 | TX CAN | RX CAN | Encr. mode | Channel mode | GPS mode | Contact index, little endian... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 59 ... | +---+---+---+---+---+---+---+---+
|
virtual |
Returns the channel mode.
Only valid for M17 channels.
|
virtual |
Returns the contact index for the DMR contact.
Only valid for DMR channels.
|
virtual |
Enables/disables sending of GPS position as meta-data.
Only valid for M17 channels.
|
virtual |
Returns the encryption mode of the channel.
Only valid for M17 channels.
|
virtual |
Returns true
if GPS position is sent as meta-data.
Only valid for M17 channels.
|
virtual |
Returns the M17 contact index.
Only valid for M17 channels.
|
virtual |
Returns the RX channel access number.
Only valid for M17 channels.
|
virtual |
Returns the RX color code.
Only valid for DMR channels.
|
virtual |
Returns the CTCSS RX sub-tone.
Only valid for FM channels.
|
virtual |
Sets the channel mode.
Only valid for M17 channels.
|
virtual |
Sets the DMR contact index.
Only valid for DMR channels.
|
virtual |
Sets the encryption mode for the channel.
Only valid for M17 channels.
|
virtual |
Sets the M17 contact index.
Only valid for M17 channels.
|
virtual |
Sets the RX channel access number.
Only valid for M17 channels.
|
virtual |
Sets the RX color code.
Only valid for DMR channels.
|
virtual |
Sets the CTCSS RX sub-tone.
Only valid for FM channels.
|
virtual |
Sets the timeslot for the channel.
Only valid for DMR channels.
|
virtual |
Sets the TX color code.
Only valid for M17 channels.
|
virtual |
Sets the TX color code.
Only valid for DMR channels.
|
virtual |
Sets the CTCSS TX sub-tone.
Only valid for FM channels.
|
virtual |
Returns the times slot for the channel.
Only valid for DMR channels.
|
virtual |
Returns the TX color code.
Only valid for M17 channels.
|
virtual |
Returns the TX color code.
Only valid for DMR channels.
|
virtual |
Returns the CTCSS TX sub-tone.
Only valid for FM channels.