|
libdrmconf 0.15.0
A library to program DMR radios.
|
Implements the binary encoding and decoding of the OpenRTX codeplug. More...
#include <openrtx_codeplug.hh>


Classes | |
| class | HeaderElement |
| Implements the codeplug header element. More... | |
| class | ChannelElement |
| Implements the binary representation of a channel. More... | |
| class | ContactElement |
| Implements the digital contact for the OpenRTX firmware. 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. | |
| bool | decode (Config *config, const ErrorStack &err=ErrorStack()) |
Decodes a binary codeplug to the given abstract configuration config. | |
| bool | postprocess (Config *config, const ErrorStack &err=ErrorStack()) const |
| Returns a post-processed configuration of the decoded config. | |
| Config * | preprocess (Config *config, const ErrorStack &err=ErrorStack()) const |
| Returns a prepared configuration for this particular radio. | |
| bool | encode (Config *config, const Flags &flags=Flags(), const ErrorStack &err=ErrorStack()) |
Encodes a given abstract configuration (config) to the device specific binary code-plug. | |
| 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. | |
| 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. | |
| 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 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 (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. | |
| bool | read (QFile &file, const ErrorStack &err=ErrorStack()) |
| Reads the specified DFU file. | |
| bool | write (const QString &filename, const ErrorStack &err=ErrorStack()) |
| Writes to the specified file. | |
| bool | write (QFile &file, const ErrorStack &err=ErrorStack()) |
| Writes to the specified file. | |
| 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. | |
Implements the binary encoding and decoding of the OpenRTX codeplug.
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. |
|
virtual |
Decodes a binary codeplug to the given abstract configuration config.
This must be implemented by the device-specific codeplug.
Implements Codeplug.
|
virtual |
Encodes a given abstract configuration (config) to the device specific binary code-plug.
This must be implemented by the device-specific codeplug.
Implements Codeplug.
|
virtual |
Encode all channels.
|
virtual |
Encodes all digital contacts in the configuration into the codeplug.
|
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.
|
virtual |
Returns a post-processed configuration of the decoded config.
By default, the passed config is returned.
Reimplemented from Codeplug.
|
virtual |
Returns a prepared configuration for this particular radio.
All unsupported features are removed from the copy. The default implementation only copies the config.
Reimplemented from Codeplug.