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::HotKeyElement Class Reference

Represents the base class of a hot-key setting entry for all AnyTone codeplugs. More...

#include <anytone_codeplug.hh>

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

Public Types

enum class  Type { Call = 0 , Menu = 1 }
 Hot-key types. More...
 
enum class  MenuItem {
  SMS = 1 , NewSMS = 2 , HotText = 3 , Inbox = 4 ,
  Outbox = 5 , Contacts = 6 , ManualDial = 7 , CallLog = 8
}
 Possible menu items. More...
 
enum class  CallType { Analog = 0 , Digital = 1 }
 Possible call types. More...
 
enum class  DigiCallType {
  Off = 0xff , GroupCall = 0 , PrivateCall = 1 , AllCall = 2 ,
  HotText = 3 , CallTip = 4 , StatusMessage = 5
}
 Possible digital call sub-types. More...
 

Public Member Functions

 HotKeyElement (uint8_t *ptr)
 Constructor.
 
void clear ()
 Resets the hot-key entry.
 
virtual Type type () const
 Returns the type of the hot-key entry.
 
virtual void setType (Type type)
 Sets the type of the hot-key entry.
 
virtual MenuItem menuItem () const
 If type returns Type::Menu, returns the menu item.
 
virtual void setMenuItem (MenuItem item)
 Sets the menu item. More...
 
virtual CallType callType () const
 If type returns Type::Call, returns the type of the call.
 
virtual void setCallType (CallType type)
 Sets the call type. More...
 
virtual DigiCallType digiCallType () const
 If type returns Type::Call and callType CalLType::Digital, returns the digital call type.
 
virtual void setDigiCallType (DigiCallType type)
 Sets the digital call type. More...
 
virtual bool hasContactIndex () const
 Returns true if the contact index is set.
 
virtual unsigned contactIndex () const
 If type is Type::Call, returns the contact index. More...
 
virtual void setContactIndex (unsigned idx)
 Sets the contact index. More...
 
virtual void clearContactIndex ()
 Clears the contact index.
 
virtual bool hasMessageIndex () const
 Returns true if a message index is set.
 
virtual unsigned messageIndex () const
 Returns the message index. More...
 
virtual void setMessageIndex (unsigned idx)
 Sets the message index.
 
virtual void clearMessageIndex ()
 Clears the message index.
 
- 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

 HotKeyElement (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 of a hot-key setting entry for all AnyTone codeplugs.

Memory encoding of a hot-key setting (size 0x0030 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 | Type (0=call, 1=menu)         | Menu item                     | Call type                     | Digital call type             |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
04 | Contact index, 0-based, little endian, 0xffffffff=none                                                                        |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
08 | Message index, 0-based        | Unused filled with 0x00                                                                    ...
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
2c  ...                                                                                                                            |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Field details:
 - Menu item: 1=Show SMS nenu, 2=Show new SMS menu, 3=Show hot text menu, 4=Show SMS inbox, 5=Show SMS outbox, 6=Show contacts,
   7=Show manual dial menu.
 - Call type: 0=analog, 1=digital (only when Type=call).
 - Digital call type: 0xff = off, 0=Group call, 1=Private call, 2=All call, 3=Hot text, 4=Call tip (?), 5=Status message.
 - Contact index: May be analog quick call index (if Type=call, and Call type=analog) or contact index (if Type=call and
   Call type=digital). 0xffffffff = none.
 - Message index: May be SMS message index (if Digital call type=Hot text) or status message index
   (if Digital call type=Status message). 0xff = none.

Member Enumeration Documentation

◆ CallType

Possible call types.

Enumerator
Analog 

Perform an analog call.

Digital 

Perform a digital call.

◆ DigiCallType

Possible digital call sub-types.

Enumerator
Off 

Call disabled.

GroupCall 

Perform a group call.

PrivateCall 

Perform private call.

AllCall 

Perform all call.

HotText 

Send a text message.

CallTip 

Send a call tip (?).

StatusMessage 

Send a state message.

◆ MenuItem

Possible menu items.

Enumerator
SMS 

Show SMS menu.

NewSMS 

Create new SMS.

HotText 

Send a hot-text.

Inbox 

Show SMS inbox.

Outbox 

Show SMS outbox.

Contacts 

Show contact list.

ManualDial 

Show manual dial.

CallLog 

Show call log.

◆ Type

Hot-key types.

Enumerator
Call 

Perform a call.

Menu 

Show a menu item.

Member Function Documentation

◆ contactIndex()

unsigned AnytoneCodeplug::HotKeyElement::contactIndex ( ) const
virtual

If type is Type::Call, returns the contact index.

This is either an index of an analog quick call if callType is CallType::Analog or a contact index if callType is CallType::Digital. If set to 0xffffffff the index is invalid.

◆ messageIndex()

unsigned AnytoneCodeplug::HotKeyElement::messageIndex ( ) const
virtual

Returns the message index.

This can either be an index of an SMS or an index of a status message.

◆ setCallType()

void AnytoneCodeplug::HotKeyElement::setCallType ( CallType  type)
virtual

Sets the call type.

For this settings to have an effect, the type must be set to Type::Call.

◆ setContactIndex()

void AnytoneCodeplug::HotKeyElement::setContactIndex ( unsigned  idx)
virtual

Sets the contact index.

This can either be an index of an analog quick-call or a contact index.

◆ setDigiCallType()

void AnytoneCodeplug::HotKeyElement::setDigiCallType ( DigiCallType  type)
virtual

Sets the digital call type.

For this setting to have an effect, the type must be Type::Call and callType must be CallType::Digital.

◆ setMenuItem()

void AnytoneCodeplug::HotKeyElement::setMenuItem ( MenuItem  item)
virtual

Sets the menu item.

For this setting to have an effect, the type must be set to Type::Menu.


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