libdrmconf  0.11.0
A library to program DMR radios.
anytone_filereader.hh
1 #ifndef ANYTONEFILEREADER_HH
2 #define ANYTONEFILEREADER_HH
3 
4 #include <QFile>
5 #include "config.hh"
6 
7 
12 {
13 public:
15  class Element
16  {
17  protected:
19  Element(const uint8_t *ptr);
20 
21  public:
23  virtual ~Element();
25  virtual size_t size() const = 0;
26 
27  protected:
29  const uint8_t *_data;
30  };
31 
32 protected:
34  AnytoneFileReader(Config *config, const uint8_t *data, size_t size, QString &message);
35 
36 public:
38  virtual ~AnytoneFileReader();
39 
40 protected:
42  virtual bool read();
43 
45  virtual bool readHeader() = 0;
47  virtual bool linkHeader() = 0;
49  virtual bool readChannels() = 0;
51  virtual bool linkChannels() = 0;
53  virtual bool readRadioIDs() = 0;
55  virtual bool linkRadioIDs() = 0;
57  virtual bool readZones() = 0;
59  virtual bool linkZones() = 0;
61  virtual bool readScanLists() = 0;
63  virtual bool linkScanLists() = 0;
65  virtual bool readAnalogContacts() = 0;
67  virtual bool linkAnalogContacts() = 0;
68 
69 public:
71  static bool read(const QString &filename, Config *config, QString &message);
72 
73 protected:
75  const uint8_t * const _start;
77  const uint8_t *_data;
79  size_t _size;
81  QString &_message;
82 };
83 
84 #endif // ANYTONEFILEREADER_HH
Base class for all elements in the codeplug file.
Definition: anytone_filereader.hh:16
virtual size_t size() const =0
Returns the storage size of the element.
virtual ~Element()
Destructor.
Definition: anytone_filereader.cc:28
const uint8_t * _data
Pointer to the actual element.
Definition: anytone_filereader.hh:29
Element(const uint8_t *ptr)
Hidden constructor.
Definition: anytone_filereader.cc:22
This class implements a reader of AnyTone codeplug files.
Definition: anytone_filereader.hh:12
virtual ~AnytoneFileReader()
Destructor.
Definition: anytone_filereader.cc:42
QString & _message
Error message.
Definition: anytone_filereader.hh:81
virtual bool readHeader()=0
Read header of file.
virtual bool readAnalogContacts()=0
Read all DTMF contacts.
const uint8_t * _data
Pointer to the entire data.
Definition: anytone_filereader.hh:77
virtual bool readRadioIDs()=0
Read all radio IDs.
virtual bool linkAnalogContacts()=0
Link elements.
virtual bool linkScanLists()=0
Link elements.
virtual bool read()
Read all elements.
Definition: anytone_filereader.cc:47
virtual bool readChannels()=0
Read all channels.
virtual bool readZones()=0
Read all zones.
virtual bool linkChannels()=0
Link elements.
size_t _size
Size of the entire blob.
Definition: anytone_filereader.hh:79
virtual bool linkRadioIDs()=0
Link elements.
AnytoneFileReader(Config *config, const uint8_t *data, size_t size, QString &message)
Constructs a configuration from the given codeplug file in memory (data, size).
Definition: anytone_filereader.cc:36
const uint8_t *const _start
Pointer to the start.
Definition: anytone_filereader.hh:75
virtual bool linkHeader()=0
Link elements.
virtual bool linkZones()=0
Link elements.
virtual bool readScanLists()=0
Read all scal lists.
The config class, representing the codeplug configuration.
Definition: config.hh:68