libdrmconf  0.11.3
A library to program DMR radios.
Classes | Public Types | Public Member Functions | Protected Types | List of all members
OpenRTXCodeplug Class Reference

Implements the binary encoding and decoding of the OpenRTX codeplug. More...

#include <openrtx_codeplug.hh>

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

Classes

class  ChannelElement
 Implements the binary representation of a channel. More...
 
class  ContactElement
 Implements the digital contact for the OpenRTX firmware. More...
 
class  HeaderElement
 Implements the codeplug header element. More...
 
class  ZoneElement
 The binary encoding of a zone. More...
 

Public Types

enum  Mode { Mode_None = 0 , Mode_FM = 1 , Mode_DMR = 2 , Mode_M17 = 3 }
 Possible modes for a channel or contact. More...
 

Public Member Functions

 OpenRTXCodeplug (QObject *parent=nullptr)
 Hidden constructor, use a device specific class to instantiate.
 
virtual ~OpenRTXCodeplug ()
 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 decodeElements (Context &ctx, const ErrorStack &err=ErrorStack())
 Decodes the binary codeplug and stores its content in the given generic configuration using the given context.
 
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.
 
virtual unsigned int numContacts ()
 Returns the number of stored contacts.
 
virtual unsigned int offsetContact (unsigned int n)
 Returns the offset to the n-th contact element.
 
virtual bool encodeContacts (Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
 Encodes all digital contacts in the configuration into the codeplug. More...
 
virtual bool createContacts (Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
 Adds a digital contact to the configuration for each one in the codeplug.
 
virtual unsigned int numChannels ()
 Returns the number of stored channels.
 
virtual unsigned int offsetChannel (unsigned int n)
 Returns the offset to the n-th channel element.
 
virtual bool encodeChannels (Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
 Encode all channels. More...
 
virtual bool createChannels (Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
 Adds all defined channels to the configuration.
 
virtual bool linkChannels (Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
 Links all channels.
 
virtual unsigned int numZones ()
 Returns the number of stored zones.
 
virtual unsigned int offsetZoneOffsets ()
 Returns the offset to the zone offset array.
 
virtual unsigned int offsetZone (unsigned int n)
 Returns the offset to the n-th zone element.
 
virtual bool encodeZones (Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
 Encodes zones.
 
virtual bool createZones (Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
 Adds zones to the configuration.
 
virtual bool linkZones (Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
 Links all zones within the configuration.
 
- 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.
 

Protected Types

enum  Offsets { HeaderSize = 0x58 , ChannelSize = 0x5a , ContactSize = 0x27 , ZoneHeaderSize =0x22 }
 Just stores some sizes.
 

Additional Inherited Members

- 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

Implements the binary encoding and decoding of the OpenRTX codeplug.

Codeplug structure within radio

The binary codeplug does not use fixed offsets. It is just a concatenation arrays of codeplug elements. This codeplug implements the revision 0.1.

Content
Header see HeaderElement.
Max. 65536 contacts as specified in the header. See ContactElement.
Max. 65536 channels as specified in the header. See ChannelElement.
Max. 65536 bank (zone) offsets as specified in the header. Each offset is stored as a ??? and specifies the offset to the bank w.r.t. ??? in ???.
Max. 65536 banks (zones). See ZoneElement.

Member Enumeration Documentation

◆ Mode

Possible modes for a channel or contact.

Enumerator
Mode_None 

Disabled?

Mode_FM 

FM Channel.

Mode_DMR 

DMR Channel.

Mode_M17 

M17 Channel.

Member Function Documentation

◆ encodeChannels()

bool OpenRTXCodeplug::encodeChannels ( Config config,
const Flags flags,
Context ctx,
const ErrorStack err = ErrorStack() 
)
virtual

Encode all channels.

Todo:
Limit number of channels.

◆ encodeContacts()

bool OpenRTXCodeplug::encodeContacts ( Config config,
const Flags flags,
Context ctx,
const ErrorStack err = ErrorStack() 
)
virtual

Encodes all digital contacts in the configuration into the codeplug.

Todo:
Limit number of contacts.

◆ index()

bool OpenRTXCodeplug::index ( Config config,
Context ctx,
const ErrorStack err = ErrorStack() 
) const
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.).

Implements Codeplug.


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