LibDMRConf  0.5.2
A library to program DMR radios.
Public Member Functions | Protected Member Functions | List of all members
CodePlug Class Referenceabstract

This class defines the interface all device-specific code-plugs must implement. More...

#include <codeplug.hh>

Inheritance diagram for CodePlug:
DFUFile D878UVCodeplug GD77Codeplug RD5RCodeplug UV390Codeplug OpenGD77Codeplug

Public Member Functions

virtual ~CodePlug ()
 Destructor.
 
virtual bool decode (Config *config)=0
 Decodes a binary codeplug to the given abstract configuration config. More...
 
virtual bool encode (Config *config, bool update=true)=0
 Encodes a given abstract configuration (config) to the device specific binary code-plug. More...
 
- 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 Member Functions

 CodePlug (QObject *parent=nullptr)
 Hidden default constructor.
 

Additional Inherited Members

- Protected Attributes inherited from DFUFile
QString _errorMessage
 Holds the error string.
 
QVector< Image > _images
 The list of images.
 

Detailed Description

This class defines the interface all device-specific code-plugs must implement.

Device-specific codeplugs are derived from the common configuration and implement the construction/parsing of the device specific binary configuration.

Member Function Documentation

◆ decode()

virtual bool CodePlug::decode ( Config config)
pure virtual

Decodes a binary codeplug to the given abstract configuration config.

This must be implemented by the device-specific codeplug.

Implemented in D878UVCodeplug, UV390Codeplug, RD5RCodeplug, GD77Codeplug, and OpenGD77Codeplug.

◆ encode()

virtual bool CodePlug::encode ( Config config,
bool  update = true 
)
pure virtual

Encodes a given abstract configuration (config) to the device specific binary code-plug.

This must be implemented by the device-specific codeplug.

Implemented in D878UVCodeplug, UV390Codeplug, RD5RCodeplug, GD77Codeplug, and OpenGD77Codeplug.


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