LibDMRConf
0.5.2
A library to program DMR radios.
|
Represents, encodes and decodes the device specific codeplug for a Baofeng/Radioddity RD-5R. More...
#include <rd5r_codeplug.hh>
Classes | |
struct | bank_t |
One bank of 128 channels including a bitmap for enabled channels. More... | |
struct | boot_settings_t |
Represents the boot settings within the binary codeplug. More... | |
struct | button_settings_t |
Represents the button settings. More... | |
struct | channel_t |
Represents a configured channel within the codeplug. More... | |
struct | contact_t |
Specific codeplug representation of a DMR contact. More... | |
struct | dtmf_contact_t |
Specific codeplug representation of a DTMF (analog) contact. More... | |
struct | general_settings_t |
Represents the general settings within the codeplug. More... | |
struct | grouplist_t |
Represents a single RX group list within the codeplug. More... | |
struct | grouptab_t |
Table of rx group lists. More... | |
struct | intro_text_t |
Represents the intro messages within the codeplug. More... | |
struct | menu_settings_t |
Represents the menu settings. More... | |
struct | msgtab_t |
Represents the table of text messages within the codeplug. More... | |
struct | scanlist_t |
Represents a sinle scan list within the codeplug. More... | |
struct | scantab_t |
Table/Bank of scanlists. More... | |
struct | timestamp_t |
Represents the codeplug time-stamp within the codeplug. More... | |
struct | vfo_settings_t |
Binary codeplug representation of VFO settings. More... | |
struct | zone_t |
Represents a single zone within the codeplug. More... | |
struct | zonetab_t |
Table of zones. More... | |
Public Member Functions | |
RD5RCodeplug (QObject *parent=0) | |
Empty constructor. | |
void | clear () |
Resets the codeplug to some default values. | |
bool | decode (Config *config) |
Decodes the read codeplug and stores the result into the given generic configuration. | |
bool | encode (Config *config, bool update=true) |
Encodes the given generic configuration into this 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. | |
Static Public Attributes | |
static const int | NCHAN = 1024 |
Defines the number of channels. | |
static const int | NCONTACTS = 256 |
Defines the number of contacts. | |
static const int | NDTMF = 32 |
Defines the number of DTMF contacts. | |
static const int | NZONES = 250 |
Defines the number of zones. | |
static const int | NGLISTS = 64 |
Defines the number of RX group lists. | |
static const int | NSCANL = 250 |
Defines the number of scanlists. | |
static const int | NMESSAGES = 32 |
Defines the number of preset 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. | |
Represents, encodes and decodes the device specific codeplug for a Baofeng/Radioddity RD-5R.
This codeplug format is quiet funny. It reveals some history of this device. First of all, the channels are organizes in two blocks. The first block contains only a single bank of 128 channels, while the second block contains 7 banks with a total of 896 channels. I would guess there was a previous firmware or even hardware version with only 128 channels.
Moreover, channels, zones, rx group lists and scan lists are organized in tables or banks, with some preceding bitfield indicating which channel is enabled/valid. Contacts, however, are just organized in a list, where each entry has a field, indicating whether that contact is valid.
This difference looks like, as if the firmware code for the contacts stems from a different device or was developed by a different engineer. Moreover, the message list again, uses yet another method. Here a simple counter preceds the messages, indicating how many valid messages there are. All in all, a rather inconsistent way of representing variable length lists in the codeplug. I would guess, that over time, different people/teams worked on different revisions of the firmware. It must have been a real nightmare to Serge Vakulenko reverse-engineering this codeplug.
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.
Please note, that the codeplug is not yet fully understood and a full codeplug cannot be build from scratch. That is, it is necessary to update an existing codeplug on the radio.
Start | End | Size | Content |
---|---|---|---|
First segment 0x00080-0x07c00 | |||
0x00080 | 0x00088 | 0x0008 | ??? Unknown ??? |
0x00088 | 0x0008e | 0x0006 | Timestamp, see RD5RCodeplug::timestamp_t . |
0x0008e | 0x000e0 | 0x0052 | CPS, firmware, DSP version numbers (not touched). |
0x000e0 | 0x00108 | 0x0028 | General settings, see RD5RCodeplug::general_settings_t . |
0x00108 | 0x00128 | 0x0020 | Button settings, see RD5RCodeplug::button_settings_t . |
0x00128 | 0x01370 | 0x1248 | 32 preset message texts, see RD5RCodeplug::msgtab_t . |
0x01370 | 0x01588 | 0x0218 | ??? Unknown ??? |
0x01588 | 0x01788 | 0x0200 | ??? 32 Emergency systems ??? |
0x01788 | 0x02f88 | 0x1800 | 256 contacts, see RD5RCodeplug::contact_t . |
0x02f88 | 0x03388 | 0x0400 | 32 DTMF contacts, see RD5RCodeplug::dtmf_contact_t . |
0x03388 | 0x03780 | 0x03f8 | ??? Unknown ??? |
0x03780 | 0x05390 | 0x1c10 | First 128 chanels (bank 0), see RD5RCodeplug::bank_t . |
0x05390 | 0x07518 | 0x2188 | ??? Unknown ??? |
0x07518 | 0x07538 | 0x0020 | Boot settings, see RD5RCodeplug::boot_settings_t . |
0x07538 | 0x07540 | 0x0008 | Menu settings, see RD5RCodeplug::menu_settings_t |
0x07540 | 0x07560 | 0x0020 | 2 intro lines, RD5RCodeplug::intro_text_t . |
0x07560 | 0x07590 | 0x0030 | ??? Unknown ??? |
0x07590 | 0x07600 | 0x0070 | VFO settings, see RD5RCodeplug::vfo_settings_t . |
0x07600 | 0x07c00 | 0x0600 | ??? Unknown ??? |
Second segment 0x08000-0x1e300 | |||
0x08000 | 0x08010 | 0x0010 | ??? Unknown ??? |
0x08010 | 0x0af10 | 0x2f00 | 250 zones, see RD5RCodeplug::zonetab_t |
0x0af10 | 0x0b1b0 | 0x02a0 | ??? Unknown ??? |
0x0b1b0 | 0x17620 | 0xc470 | Remaining 896 chanels (bank 1-7), see RD5RCodeplug::bank_t |
0x17620 | 0x1cd10 | 0x56f0 | 250 scan lists, see RD5RCodeplug::scantab_t |
0x1cd10 | 0x1d620 | 0x0910 | ??? Unknown ??? |
0x1d620 | 0x1e2a0 | 0x0c80 | 64 RX group lists, see RD5RCodeplug::grouptab_t |
0x1e2a0 | 0x1e300 | 0x0060 | ??? Unknown ??? |