libdrmconf  0.12.0
A library to program DMR radios.
Classes | Public Member Functions | List of all members
MD390Codeplug Class Reference

Device specific implementation of the codeplug for the TyT MD-390(U/V). More...

#include <md390_codeplug.hh>

Inheritance diagram for MD390Codeplug:
Inheritance graph
[legend]
Collaboration diagram for MD390Codeplug:
Collaboration graph
[legend]

Classes

class  ChannelElement
 Extends the common TyTCodeplug::ChannelElement to implement the MD-390 specific settings. More...
 
class  MenuSettingsElement
 Extends the TyTCodeplug::MenuSettingsElement to implement the MD-390 specific menu settings. More...
 
struct  Offset
 Some internal offsets within the codeplug. More...
 

Public Member Functions

 MD390Codeplug (QObject *parent=nullptr)
 Empty constructor.
 
Configpreprocess (Config *config, const ErrorStack &err) const
 Retruns a prepared configuration for this particular radio. More...
 
bool postprocess (Config *config, const ErrorStack &err) const
 Retruns a post-processed configuration of the decoded config. More...
 
virtual bool decodeElements (Context &ctx, const ErrorStack &err=ErrorStack())
 Decodes the binary codeplug and stores its content in the given generic configuration using the given context.
 
void clearTimestamp ()
 Clears the time-stamp in the codeplug.
 
bool encodeTimestamp ()
 Sets the time-stamp.
 
void clearGeneralSettings ()
 Clears the general settings in the codeplug.
 
bool encodeGeneralSettings (Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
 Updates the general settings from the given configuration.
 
bool decodeGeneralSettings (Config *config, const ErrorStack &err=ErrorStack())
 Updates the given configuration from the general settings.
 
void clearChannels ()
 Clears all channels in the codeplug.
 
bool encodeChannels (Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
 Encodes all channels in the configuration into the codeplug.
 
bool createChannels (Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
 Adds a channel to the configuration for each one in the codeplug.
 
bool linkChannels (Context &ctx, const ErrorStack &err=ErrorStack())
 Links all added channels within the configuration.
 
void clearContacts ()
 Clears all contacts in the codeplug.
 
bool encodeContacts (Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
 Encodes all digital contacts in the configuration into the codeplug.
 
bool createContacts (Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
 Adds a digital contact to the configuration for each one in the codeplug.
 
void clearZones ()
 Clears all zones in the codeplug.
 
bool encodeZones (Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
 Encodes all zones in the configuration into the codeplug.
 
bool createZones (Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
 Adds a zone to the configuration for each one in the codeplug.
 
bool linkZones (Context &ctx, const ErrorStack &err=ErrorStack())
 Links all added zones within the configuration.
 
void clearGroupLists ()
 Clears all RX group lists in the codeplug.
 
bool encodeGroupLists (Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
 Encodes all group lists in the configuration into the codeplug.
 
bool createGroupLists (Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
 Adds a RX group list to the configuration for each one in the codeplug.
 
bool linkGroupLists (Context &ctx, const ErrorStack &err=ErrorStack())
 Links all added RX group lists within the configuration.
 
void clearScanLists ()
 Clears all scan lists in the codeplug.
 
bool encodeScanLists (Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
 Encodes all scan lists in the configuration into the codeplug.
 
bool createScanLists (Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
 Adds a scan list to the configuration for each one in the codeplug.
 
bool linkScanLists (Context &ctx, const ErrorStack &err=ErrorStack())
 Links all added scan lists within the configuration.
 
void clearPositioningSystems ()
 Clears all positioning systems in the codeplug.
 
bool encodePositioningSystems (Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
 Encodes all DMR positioning systems in the configuration into the codeplug.
 
bool createPositioningSystems (Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
 Adds a GPS positioning system to the configuration for each one in the codeplug.
 
bool linkPositioningSystems (Context &ctx, const ErrorStack &err=ErrorStack())
 Links all added positioning systems within the configuration.
 
void clearButtonSettings ()
 Clears the button settings in the codeplug.
 
bool encodeButtonSettings (Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
 Encodes the button settings.
 
bool decodeButtonSetttings (Config *config, const ErrorStack &err=ErrorStack())
 Decodes the button settings.
 
void clearPrivacyKeys ()
 Clears all encryption keys in the codeplug.
 
bool encodePrivacyKeys (Config *config, const Flags &flags, Context &ctx, const ErrorStack &err)
 Encodes the encryption keys.
 
bool decodePrivacyKeys (Config *config, Context &ctx, const ErrorStack &err)
 Decodes the encryption keys.
 
void clearTextMessages ()
 Clears all text messages in the codeplug.
 
bool encodeTextMessages (Context &ctx, const Flags &flags, const ErrorStack &err)
 Encodes text messages.
 
bool decodeTextMessages (Context &ctx, const ErrorStack &err)
 Decodes text messages.
 
void clearMenuSettings ()
 Clears the menu settings in the codeplug.
 
void clearEmergencySystems ()
 Clears all emergency systems in the codeplug.
 
- Public Member Functions inherited from TyTCodeplug
virtual ~TyTCodeplug ()
 Destructor.
 
virtual void clear ()
 Clears and resets the complete codeplug to some default values.
 
bool index (Config *config, Context &ctx, const ErrorStack &err=ErrorStack()) const
 Indexes all elements of the codeplug. More...
 
bool decode (Config *config, const ErrorStack &err=ErrorStack())
 Decodes the binary codeplug and stores its content in the given generic configuration.
 
bool encode (Config *config, const Flags &flags=Flags(), const ErrorStack &err=ErrorStack())
 Encodes the given generic configuration as a binary codeplug.
 
virtual bool encodeElements (const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
 Encodes the given generic configuration as a binary codeplug using the given context.
 
- 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 Imageimage (int i) const
 Returns a reference to the i-th image of the file.
 
Imageimage (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 (unsigned blocksize) const
 Checks if all image addresses and sizes is aligned with the given block size.
 
bool read (const QString &filename, const ErrorStack &err=ErrorStack())
 Reads the specified DFU file. More...
 
bool read (QFile &file, const ErrorStack &err=ErrorStack())
 Reads the specified DFU file. More...
 
bool write (const QString &filename, const ErrorStack &err=ErrorStack())
 Writes to the specified file. More...
 
bool write (QFile &file, const ErrorStack &err=ErrorStack())
 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 bool isAllocated (uint32_t offset, uint32_t img=0) const
 Returns true if the specified address (and image) is allocated.
 
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.
 

Additional Inherited Members

- Protected Member Functions inherited from TyTCodeplug
 TyTCodeplug (QObject *parent=nullptr)
 Empty constructor.
 
- Protected Member Functions inherited from Codeplug
 Codeplug (QObject *parent=nullptr)
 Hidden default constructor.
 
- Protected Attributes inherited from DFUFile
QVector< Image_images
 The list of images.
 

Detailed Description

Device specific implementation of the codeplug for the TyT MD-390(U/V).

The codeplug consists of a single segment. It starts at address 0x002000 and ends at address 0x040000.

Codeplug structure within radio

The codeplug structure is reverse engineered almost completely and can be programmed from scratch. That is, it is not necessary to update an existing codeplug on the radio.

Start End Size Content
Segment 0x002000-0x040000
0x002000 0x00200c 0x0000c Timestamp see TyTCodeplug::TimestampElement.
0x00200c 0x002040 0x00034 Reserved, filled with 0xff.
0x002100 0x002140 0x00040 Button config, see TyTCodeplug::ButtonSettingsElement.
0x002140 0x002180 0x00040 Reserved, filled with 0xff.
0x002040 0x0020f0 0x000b0 General settings see TyTCodeplug::GeneralSettingsElement.
0x002180 0x0059c0 0x03840 50 Text messages @ 0x120 bytes each, see TyTCodeplug::MessageElement.
0x0059c0 0x005a70 0x000b0 ??? Privacy keys, see TyTCodeplug::EncryptionElement.
0x005a70 0x005a80 0x00010 Emergency system settings, see TyTCodeplug::EmergencySettingsElement.
0x005a80 0x005f80 0x00500 Emergency systems, see TyTCodeplug::EmergencySystemElement.
0x005f80 0x00ec20 0x008ca 1000 contacts, see TyTCodeplug::ContactElement.
0x00ec20 0x0149e0 0x05dc0 250 RX Group lists @ 0x60 bytes each, see TyTCodeplug::GroupListElement.
0x0149e0 0x018860 0x03e80 250 Zones @ 0x40 bytes each, see TyTCodeplug::ZoneElement.
0x018860 0x01edf0 0x06590 250 Scanlists @ 0x68 bytes each, see TyTCodeplug::ScanListElement.
0x01ee00 0x02e800 0x0fa00 1000 channels, see MD390Codeplug::ChannelElement.
0x03ec40 0x03ed40 0x00100 16 GPS systems @ 0x10 bytes each, see TyTCodeplug::GPSSystemElement.

Member Function Documentation

◆ postprocess()

bool MD390Codeplug::postprocess ( Config config,
const ErrorStack err 
) const
virtual

Retruns a post-processed configuration of the decoded config.

By default, the passed config is returned.

Reimplemented from Codeplug.

◆ preprocess()

Config * MD390Codeplug::preprocess ( Config config,
const ErrorStack err 
) const
virtual

Retruns a prepared configuration for this particular radio.

All unsupported featrues are removed from the copy. The default implementation only copies the config.

Reimplemented from Codeplug.


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