libdrmconf  0.10.4
A library to program DMR radios.
Public Member Functions | Protected Types | Protected Member Functions | List of all members
OpenRTXCodeplug::ContactElement Class Reference

Implements the digital contact for the OpenRTX firmware. More...

#include <openrtx_codeplug.hh>

Inheritance diagram for OpenRTXCodeplug::ContactElement:
Inheritance graph
[legend]
Collaboration diagram for OpenRTXCodeplug::ContactElement:
Collaboration graph
[legend]

Public Member Functions

 ContactElement (uint8_t *ptr)
 Constructor.
 
virtual ~ContactElement ()
 Destructor.
 
void clear ()
 Resets the contact.
 
bool isValid () const
 Returns true if the contact is valid.
 
virtual QString name () const
 Returns the name of the contact.
 
virtual void setName (const QString &name)
 Sets the name of the contact.
 
virtual Mode mode () const
 Returns the mode of the contact (either DMR or M17).
 
virtual void setMode (Mode mode)
 Sets the mode of the contact.
 
virtual unsigned int dmrId () const
 Returns the DMR ID. More...
 
virtual void setDMRId (unsigned int id)
 Sets the DMR ID. More...
 
virtual bool dmrRing () const
 Returns true if the RX tone is enabled (ring). More...
 
virtual void enableDMRRing (bool enable)
 Enables/disables RX tone (ring). More...
 
virtual DMRContact::Type dmrContactType () const
 Returns the contact type. More...
 
virtual void setDMRContactType (DMRContact::Type type)
 Sets the contact type.
 
virtual QString m17Call () const
 Returns the contact call.
 
virtual bool setM17Call (const QString &call, const ErrorStack &err=ErrorStack())
 Sets the M17 call.
 
virtual DMRContacttoContactObj (Context &ctx, const ErrorStack &err=ErrorStack()) const
 Constructs a DigitalContact instance from this codeplug contact.
 
virtual void fromContactObj (const DMRContact *obj, Context &ctx, const ErrorStack &err=ErrorStack())
 Resets this codeplug contact from the given DigitalContact.
 
- Public Member Functions inherited from Codeplug::Element
 Element (const Element &other)
 Copy constructor.
 
virtual ~Element ()
 Destructor.
 
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 Types

enum  Offsets {
  OffsetName = 0x00 , OffsetMode = 0x20 , OffsetDMRId = 0x21 , OffsetDMRCallType = 0x25 ,
  BitDMRCallType = 0 , OffsetDMRRing = 0x25 , BitDMRRing = 0x02 , OffsetM17Address = 0x21 ,
  StringLength = 0x20
}
 Just holds the offsets within the codeplug.
 

Protected Member Functions

 ContactElement (uint8_t *ptr, unsigned 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.
 

Detailed Description

Implements the digital contact for the OpenRTX firmware.

Binary representation (size 0027h 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 | Name, 32 x ASCII, 0-pad                                                                                                    ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
1c  ...                                                                                                                            |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
20 | Mode, only DMR or M17         | Mode specific settings, 6 bytes, see below                                                 ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
24  ...                                                                                            |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Mode: 0=None, 1=FM, 2=DMR, 3=M17, only DMR and M17 are valid.


DMR Contact 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
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
21 | DMR ID, 32bit uint, little endian                                                                                             |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
25 | Unused, set to 0  |RXT| CType | Unused set to 0               |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

RXT: RX Tone enable (ring).
CType: Contact type.

M17 Contact 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
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
21 | M17 encoded address                                                                                                        ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
25  ...                                                            |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Member Function Documentation

◆ dmrContactType()

DMRContact::Type OpenRTXCodeplug::ContactElement::dmrContactType ( ) const
virtual

Returns the contact type.

Only valid for DMR contacts.

◆ dmrId()

unsigned int OpenRTXCodeplug::ContactElement::dmrId ( ) const
virtual

Returns the DMR ID.

Only valid for DMR contacts.

◆ dmrRing()

bool OpenRTXCodeplug::ContactElement::dmrRing ( ) const
virtual

Returns true if the RX tone is enabled (ring).

Only valid for DMR contacts.

◆ enableDMRRing()

void OpenRTXCodeplug::ContactElement::enableDMRRing ( bool  enable)
virtual

Enables/disables RX tone (ring).

Only valid for DMR contacts.

◆ setDMRId()

void OpenRTXCodeplug::ContactElement::setDMRId ( unsigned int  id)
virtual

Sets the DMR ID.

Only valid for DMR contacts.


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