libdrmconf  0.12.0
A library to program DMR radios.
Classes | 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:
Inheritance graph
[legend]
Collaboration diagram for Codeplug:
Collaboration graph
[legend]

Classes

class  Context
 Base class for all codeplug contexts. More...
 
class  Element
 Represents the abstract base class of all codeplug elements. More...
 
class  Flags
 Certain flags passed to CodePlug::encode to control the transfer and encoding of the codeplug. More...
 

Public Member Functions

virtual ~Codeplug ()
 Destructor.
 
virtual bool index (Config *config, Context &ctx, const ErrorStack &err=ErrorStack()) const =0
 Indexes all elements of the codeplug. More...
 
virtual bool decode (Config *config, const ErrorStack &err=ErrorStack())=0
 Decodes a binary codeplug to the given abstract configuration config. More...
 
virtual bool postprocess (Config *config, const ErrorStack &err=ErrorStack()) const
 Retruns a post-processed configuration of the decoded config. More...
 
virtual Configpreprocess (Config *config, const ErrorStack &err=ErrorStack()) const
 Retruns a prepared configuration for this particular radio. More...
 
virtual bool encode (Config *config, const Flags &flags=Flags(), const ErrorStack &err=ErrorStack())=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 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.
 

Protected Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from DFUFile
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,
const ErrorStack err = ErrorStack() 
)
pure virtual

Decodes a binary codeplug to the given abstract configuration config.

This must be implemented by the device-specific codeplug.

Implemented in TyTCodeplug, RadioddityCodeplug, OpenRTXCodeplug, GD73Codeplug, DR1801UVCodeplug, and AnytoneCodeplug.

◆ encode()

virtual bool Codeplug::encode ( Config config,
const Flags flags = Flags(),
const ErrorStack err = ErrorStack() 
)
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 TyTCodeplug, RadioddityCodeplug, OpenRTXCodeplug, GD73Codeplug, DR1801UVCodeplug, and AnytoneCodeplug.

◆ index()

virtual bool Codeplug::index ( Config config,
Context ctx,
const ErrorStack err = ErrorStack() 
) const
pure virtual

Indexes all elements of the codeplug.

This method must be implemented by any device or vendor specific codeplug to map config objects to indices used within the binary codeplug to address each element (e.g., channels, contacts etc.).

Implemented in TyTCodeplug, RadioddityCodeplug, OpenRTXCodeplug, GD73Codeplug, DR1801UVCodeplug, and AnytoneCodeplug.

◆ postprocess()

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

Retruns a post-processed configuration of the decoded config.

By default, the passed config is returned.

Reimplemented in GD73Codeplug, RadioddityCodeplug, MD390Codeplug, DR1801UVCodeplug, and AnytoneCodeplug.

◆ preprocess()

Config * Codeplug::preprocess ( Config config,
const ErrorStack err = ErrorStack() 
) 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 in GD73Codeplug, RadioddityCodeplug, MD390Codeplug, DR1801UVCodeplug, and AnytoneCodeplug.


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