LibDMRConf  0.5.2
A library to program DMR radios.
Classes | Public Member Functions | Protected Types | Static Protected Attributes | List of all members
GD77Codeplug Class Reference

Represents, encodes and decodes the device specific codeplug for a Radioddity GD-77. More...

#include <gd77_codeplug.hh>

Inheritance diagram for GD77Codeplug:
CodePlug DFUFile OpenGD77Codeplug

Classes

struct  bank_t
 A Bank of 128 channels. More...
 
struct  channel_t
 Channel representation within the binary codeplug. More...
 
struct  contact_t
 Specific codeplug representation of a DMR contact. More...
 
struct  grouplist_t
 Represents an RX group list within the codeplug. More...
 
struct  grouptab_t
 Table of RX group lists. More...
 
struct  scanlist_t
 Represents a sinle scan list within the codeplug. More...
 
struct  scantab_t
 Table/Bank of scanlists. More...
 

Public Member Functions

 GD77Codeplug (QObject *parent=nullptr)
 Constructs an empty codeplug for the GD-77.
 
bool decode (Config *config)
 Decodes the binary codeplug and stores its content in the given generic configuration.
 
bool encode (Config *config, bool update=true)
 Encodes the given generic configuration as a binary codeplug.
 
- Public Member Functions inherited from CodePlug
virtual ~CodePlug ()
 Destructor.
 
- Public Member Functions inherited from DFUFile
 DFUFile (QObject *parent=nullptr)
 Constructs an empty DFU file object.
 
uint32_t size () const
 Returns the total size of the DFU file.
 
uint32_t memSize () const
 Returns the total memory size stored in the DFU file.
 
int numImages () const
 Returns the number of images within the DFU file.
 
const Image & image (int i) const
 Returns a reference to the i-th image of the file.
 
Image & image (int i)
 Returns a reference to the i-th image of the file.
 
void addImage (const QString &name, uint8_t altSettings=1)
 Adds a new image to the file.
 
void addImage (const Image &img)
 Adds an image to the file.
 
void remImage (int i)
 Deletes the i-th image from the file.
 
bool isAligned (uint blocksize) const
 Checks if all image addresses and sizes is aligned with the given block size.
 
const QString & errorMessage () const
 Returns the error message in case of an error.
 
bool read (const QString &filename)
 Reads the specified DFU file. More...
 
bool read (QFile &file)
 Reads the specified DFU file. More...
 
bool write (const QString &filename)
 Writes to the specified file. More...
 
bool write (QFile &file)
 Writes to the specified file. More...
 
void dump (QTextStream &stream) const
 Dumps a text representation of the DFU file structure to the specified text stream.
 
virtual unsigned char * data (uint32_t offset, uint32_t img=0)
 Returns a pointer to the encoded raw data at the specified offset.
 
virtual const unsigned char * data (uint32_t offset, uint32_t img=0) const
 Returns a const pointer to the encoded raw data at the specified offset.
 

Protected Types

typedef RD5RCodeplug::zone_t zone_t
 Represents a single zone within the codeplug. More...
 
typedef RD5RCodeplug::zonetab_t zonetab_t
 Table of zones. More...
 
typedef RD5RCodeplug::general_settings_t general_settings_t
 Represents the general settings within the codeplug. More...
 
typedef RD5RCodeplug::intro_text_t intro_text_t
 Represents the intro lines within the codeplug. More...
 
typedef RD5RCodeplug::msgtab_t msgtab_t
 Represents the table of preset messages within the codeplug. More...
 
typedef RD5RCodeplug::timestamp_t timestamp_t
 Represents the timestamp within the codeplug. More...
 

Static Protected Attributes

static const int NCHAN = 1024
 The number of channels.
 
static const int NCONTACTS = 1024
 The number of contacts.
 
static const int NZONES = 250
 The number of zones.
 
static const int NGLISTS = 76
 The number of RX group-lists.
 
static const int NSCANL = 64
 The number of scan-lists.
 
static const int NMESSAGES = 32
 The number of predefined text messages.
 

Additional Inherited Members

- Protected Member Functions inherited from CodePlug
 CodePlug (QObject *parent=nullptr)
 Hidden default constructor.
 
- Protected Attributes inherited from DFUFile
QString _errorMessage
 Holds the error string.
 
QVector< Image > _images
 The list of images.
 

Detailed Description

Represents, encodes and decodes the device specific codeplug for a Radioddity GD-77.

The GD-77 & GD-77S codeplugs are almost identical to the Radioddity/Baofeng RD5RCodeplug, in fact the memory layout (see below) and almost all of the single components of the codeplug are encoded in exactly the same way. Obviously, when Baofeng and Radioddity joint to create the RD5R, Radioddity provided the firmware. However, there are some small subtile differences between these two codeplug formats, requireing a separate class for the GD-77. For example, the contacts and scan-lists swapped the addresses and the channel_t encoding analog and digital channels for the codeplugs are identical except for the squelch settings. Thanks for that!

Codeplug structure within radio

The memory representation of the codeplug within the radio is divided into two segments. The first segment starts at the address 0x00080 and ends at 0x07c00 while the second section starts at 0x08000 and ends at 0x1e300.

Start End Size Content
First segment 0x00080-0x07c00
0x00080 0x00088 0x0008 ??? Unknown ???
0x00088 0x0008e 0x0006 Timestamp, see GD77Codeplug::timestamp_t.
0x0008e 0x000e0 0x0052 ??? Unknown ???
0x000e0 0x000ec 0x000c General settings, see GD77Codeplug::general_settings_t.
0x000ec 0x00128 0x003c ??? Unknown ???
0x00128 0x01370 0x1248 32 message texts, see GD77Codeplug::msgtab_t
0x01370 0x01790 0x0420 ??? Unknown ???
0x01790 0x02dd0 0x1640 64 scan lists, see GD77Codeplug::scanlist_t
0x02dd0 0x03780 0x09b0 ??? Unknown ???
0x03780 0x05390 0x1c10 First 128 chanels (bank 0), see GD77Codeplug::bank_t
0x05390 0x07540 0x21b0 ??? Unknown ???
0x07540 0x07560 0x0020 2 intro lines, GD77Codeplug::intro_text_t
0x07560 0x07c00 0x06a0 ??? Unknown ???
Second segment 0x08000-0x1e300
0x08000 0x08010 0x0010 ??? Unknown ???
0x08010 0x0af10 0x2f00 68 zones of 80 channels each, see GD77Codeplug::zonetab_t
0x0af10 0x0b1b0 0x02a0 ??? Unknown ???
0x0b1b0 0x17620 0xc470 Remaining 896 chanels (bank 1-7), see GD77Codeplug::bank_t
0x17620 0x1d620 0x6000 1024 contacts, see GD77Codeplug::contact_t.
0x1d620 0x1e2a0 0x0c80 64 RX group lists, see GD77Codeplug::grouptab_t
0x1e2a0 0x1e300 0x0060 ??? Unknown ???

Member Typedef Documentation

◆ general_settings_t

Represents the general settings within the codeplug.

This representation is identical to the general settings of the RD-5R codeplug. Hence, it gets reused here.

◆ intro_text_t

Represents the intro lines within the codeplug.

This representation is identical to the intro lines of the RD-5R codeplug. Hence, it gets reused here.

◆ msgtab_t

Represents the table of preset messages within the codeplug.

This representation is identical to the table of messages of the RD-5R codeplug. Hence, it gets reused here.

◆ timestamp_t

Represents the timestamp within the codeplug.

This representation is identical to the timestamp of the RD-5R codeplug. Hence, it gets reused here.

◆ zone_t

Represents a single zone within the codeplug.

This representation is identical to the zone representation within the RD-5R codeplug. Hence, it gets reused.

◆ zonetab_t

Table of zones.

This representation is identical to the zone table within the RD-5R codeplug. Hence, it gets reused.


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