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

Represents the base class for scan lists in all AnyTone codeplugs. More...

#include <anytone_codeplug.hh>

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

Public Types

enum class  PriChannel { Off = 0 , Primary = 1 , Secondary = 2 , Both = 3 }
 Defines all possible priority channel selections. More...
 
enum class  RevertChannel {
  Selected = 0 , SelectedActive = 1 , Primary = 2 , Secondary = 3 ,
  LastCalled = 4 , LastUsed = 5 , PrimaryActive = 6 , SecondaryActive = 7
}
 Defines all possible reply channel selections. More...
 

Public Member Functions

 ScanListElement (uint8_t *ptr)
 Constructor.
 
void clear ()
 Resets the scan list.
 
virtual PriChannel priorityChannels () const
 Returns the priority channel selection.
 
virtual void setPriorityChannels (PriChannel sel)
 Sets the priority channel selection.
 
virtual bool hasPrimary () const
 Returns true if the primary channel is set.
 
virtual bool primaryIsSelected () const
 Returns true if the primary channel is set to the selected channel.
 
virtual unsigned primary () const
 Returns the primary channel index.
 
virtual void setPrimary (unsigned idx)
 Sets the primary channel index.
 
virtual void setPrimarySelected ()
 Sets the primary channel to be selected channel.
 
virtual void clearPrimaryChannel ()
 Clears the primary channel index.
 
virtual bool hasSecondary () const
 Returns true if the secondary channel is set.
 
virtual bool secondaryIsSelected () const
 Returns true if the secondary channel is set to the selected channel.
 
virtual unsigned secondary () const
 Returns the secondary channel index.
 
virtual void setSecondary (unsigned idx)
 Sets the secondary channel index.
 
virtual void setSecondarySelected ()
 Sets the secondary channel to be selected channel.
 
virtual void clearSecondaryChannel ()
 Clears the secondary channel index.
 
virtual unsigned lookBackTimeA () const
 Returns the look back time A in seconds.
 
virtual void setLookBackTimeA (unsigned sec)
 Sets the look back time A in seconds.
 
virtual unsigned lookBackTimeB () const
 Returns the look back time B in seconds.
 
virtual void setLookBackTimeB (unsigned sec)
 Sets the look back time B in seconds.
 
virtual unsigned dropOutDelay () const
 Returns the drop out delay in seconds.
 
virtual void setDropOutDelay (unsigned sec)
 Sets the drop out delay in seconds.
 
virtual unsigned dwellTime () const
 Returns the dwell time in seconds.
 
virtual void setDwellTime (unsigned sec)
 Sets the dwell time in seconds.
 
virtual RevertChannel revertChannel () const
 Returns the revert channel type.
 
virtual void setRevertChannel (RevertChannel type)
 Sets the revert channel type.
 
virtual QString name () const
 Returns the name of the scan list.
 
virtual void setName (const QString &name)
 Sets the name of the scan list.
 
virtual bool hasMemberIndex (unsigned n) const
 Returns true if the n-th member index is set.
 
virtual unsigned memberIndex (unsigned n) const
 Returns the n-th member index.
 
virtual void setMemberIndex (unsigned n, unsigned idx)
 Sets the n-th member index.
 
virtual void clearMemberIndex (unsigned n)
 Clears the n-th member index.
 
virtual ScanListtoScanListObj () const
 Constructs a ScanList object from this definition. More...
 
virtual bool linkScanListObj (ScanList *lst, Context &ctx) const
 Links all channels (members and primary channels) with the given scan-list object.
 
virtual bool fromScanListObj (ScanList *lst, Context &ctx)
 Constructs the binary representation from the give config.
 
- Public Member Functions inherited from Codeplug::Element
 Element (const Element &other)
 Copy constructor.
 
virtual ~Element ()
 Destructor.
 
virtual bool isValid () const
 Returns true if the pointer is not null.
 
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...
 

Static Public Member Functions

static constexpr unsigned int size ()
 Returns the size of the element.
 

Protected Member Functions

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

Represents the base class for scan lists in all AnyTone codeplugs.

Memory layout of encoded scanlist (0x90 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 | Unused, set to 0x00           | Priority Channel Select       | Primary channel index 1 +1, little endian, 0=selected         |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
04 | Secondary channel index 2 +1, little endian, 0=selected       | Look back time A, in x10sec                                   |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
08 | Look back time B, in x10sec                                   | Dropout delay, in x10sec                                      |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
0c | Dwell time, in x10sec                                         | Revert channel type           | Name, 16 ASCII, 0-padded   ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
1c  ...                                                                                            | Unused, set to 0x00           |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
20 | 50 x 16bit channel indices, little endian, 0xffff=empty                                                                    ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
80  ...                                                                                                                            |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
84 | 12 unused bytes , set to 0x00                                                                                              ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
8c  ...                                                                                                                            |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Member Enumeration Documentation

◆ PriChannel

Defines all possible priority channel selections.

Enumerator
Off 

Off.

Primary 

Priority Channel Select 1.

Secondary 

Priority Channel Select 2.

Both 

Priority Channel Select 1 + Priority Channel Select 2.

◆ RevertChannel

Defines all possible reply channel selections.

Enumerator
Selected 

Selected channel.

SelectedActive 

Selected + active channel.

Primary 

Primary channel.

Secondary 

Secondary channel.

LastCalled 

Last Called.

LastUsed 

Last Used.

PrimaryActive 

Primary + active channel.

SecondaryActive 

Secondary + active channel.

Member Function Documentation

◆ toScanListObj()

ScanList * AnytoneCodeplug::ScanListElement::toScanListObj ( ) const
virtual

Constructs a ScanList object from this definition.

This only sets the properties of the scan list. To associate all members with the scan list object, call linkScanListObj.


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