libdrmconf  0.12.0
A library to program DMR radios.
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
GD73Codeplug::ScanListElement Class Reference

Implements a scan list. More...

#include <gd73_codeplug.hh>

Inheritance diagram for GD73Codeplug::ScanListElement:
Inheritance graph
[legend]
Collaboration diagram for GD73Codeplug::ScanListElement:
Collaboration graph
[legend]

Classes

struct  Limit
 Some limits. More...
 
struct  Offset
 Some internal offsets within the scan list bank. More...
 

Public Types

enum class  ChannelMode { None =0 , Fixed =1 , Selected =2 }
 Possible priority/revert channel modes.
 

Public Member Functions

 ScanListElement (uint8_t *ptr)
 Constructor.
 
QString name () const
 Returns the name of the scan list.
 
void setName (const QString &name)
 Sets the name of the scan list.
 
ChannelMode primaryChannelMode () const
 Returns the primary channel mode.
 
void setPrimaryChannelMode (ChannelMode mode)
 Sets the primary channel mode.
 
bool hasPrimaryZoneIndex () const
 Returns true, if a primary zone is set.
 
unsigned int primaryZoneIndex () const
 Returns the primary zone index.
 
void setPrimaryZoneIndex (unsigned int idx)
 Sets the primary zone index.
 
void clearPrimaryZoneIndex ()
 Clears the primary zone index.
 
bool hasPrimaryChannelIndex () const
 Returns true, if a primary channel is set.
 
unsigned int primaryChannelIndex () const
 Returns the primary channel index.
 
void setPrimaryChannelIndex (unsigned int idx)
 Sets the primary channel index.
 
void clearPrimaryChannelIndex ()
 Clears the primary channel index.
 
ChannelMode secondaryChannelMode () const
 Returns the secondary channel mode.
 
void setSecondaryChannelMode (ChannelMode mode)
 Sets the secondary channel mode.
 
bool hasSecondaryZoneIndex () const
 Returns true, if a secondary zone is set.
 
unsigned int secondaryZoneIndex () const
 Returns the secondary zone index.
 
void setSecondaryZoneIndex (unsigned int idx)
 Sets the secondary zone index.
 
void clearSecondaryZoneIndex ()
 Clears the secondary zone index.
 
bool hasSecondaryChannelIndex () const
 Returns true, if a secondary channel is set.
 
unsigned int secondaryChannelIndex () const
 Returns the secondary channel index.
 
void setSecondaryChannelIndex (unsigned int idx)
 Sets the secondary channel index.
 
void clearSecondaryChannelIndex ()
 Clears the secondary channel index.
 
ChannelMode revertChannelMode () const
 Returns the revert channel mode.
 
void setRevertChannelMode (ChannelMode mode)
 Sets the revert channel mode.
 
bool hasRevertZoneIndex () const
 Returns true, if a revert zone is set.
 
unsigned int revertZoneIndex () const
 Returns the revert zone index.
 
void setRevertZoneIndex (unsigned int idx)
 Sets the revert zone index.
 
void clearRevertZoneIndex ()
 Clears the revert zone index.
 
bool hasRevertChannelIndex () const
 Returns true, if a revert channel is set.
 
unsigned int revertChannelIndex () const
 Returns the revert channel index.
 
void setRevertChannelIndex (unsigned int idx)
 Sets the revert channel index.
 
void clearRevertChannelIndex ()
 Clears the revert channel index.
 
Interval rxHoldTime () const
 Returns the RX hold time.
 
void setRXHoldTime (const Interval &interval)
 Sets the RX hold time.
 
Interval txHoldTime () const
 Returns the TX hold time.
 
void setTXHoldTime (const Interval &interval)
 Sets the TX hold time.
 
ScanListtoScanList (Context &ctx, const ErrorStack &err=ErrorStack())
 Constructs a ScanList from this elemet.
 
bool linkScanList (ScanList *lst, Context &ctx, const ErrorStack &err=ErrorStack())
 Links a decoded scan list.
 
bool encode (ScanList *lst, Context &ctx, const ErrorStack &err=ErrorStack())
 Encodes the scan list.
 
- Public Member Functions inherited from Codeplug::Element
 Element (const Element &other)
 Copy constructor.
 
virtual ~Element ()
 Destructor.
 
Elementoperator= (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 element.
 

Protected Member Functions

 ScanListElement (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.
 

Detailed Description

Implements a scan list.

Memory representation of the scan list (size 005fh 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, 8 x 16bit unicode, little endian, 0-padded                                                                           ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
0c  ...                                                                                                                         ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
10 | Channel count                 | Channel 0, index+1, little endian                             | Channel 1, index+1,        ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
    ...                                                                                                                         ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
50  ...                            | Priority channel 1 mode       | Priority channel 2 mode       | Pri. ch. 1, zone index+1      |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
54 | Pri. ch. 2, zone index+1      | Pri. ch. 1, channel index+1, little endian                    | Pri. ch. 2, channel index+1...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
58  ... little endian              | TX ch. mode                   | TX ch. zone index +1          | TX ch. channel index+1,    ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
5c  ... little endian              | Hold time in 0.5s, 0..10s     | TX Hold time in 0.5s, 0..5s   |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Where:
 - Priority channel 1/2 mode: 0=None, 1=Fixed, 2=Selected

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