libdrmconf  0.10.4
A library to program DMR radios.
opengd77_callsigndb.hh
1 #ifndef OPENGD77CALLSIGNDB_HH
2 #define OPENGD77CALLSIGNDB_HH
3 
4 #include "callsigndb.hh"
5 #include "userdatabase.hh"
6 
20 {
21  Q_OBJECT
22 
23 public:
28  struct __attribute__((packed)) userdb_entry_t {
29  uint32_t number;
30  char name[15];
31 
35  void clear();
36 
38  uint32_t getNumber() const;
40  void setNumber(uint32_t number);
41 
43  QString getName() const;
46  void setName(const QString &name);
47 
49  void fromEntry(const UserDatabase::User &user);
50  };
51 
57  struct __attribute__((packed)) userdb_t {
58  char magic[3];
59  uint8_t size;
60  char version[3];
61  uint8_t unused6;
62  uint32_t count;
63 
65  userdb_t();
67  void clear();
69  void setSize(unsigned n);
70  };
71 
72 
73 public:
75  explicit OpenGD77CallsignDB(QObject *parent=nullptr);
77  virtual ~OpenGD77CallsignDB();
78 
80  virtual bool encode(UserDatabase *calldb, const Selection &selection=Selection(),
81  const ErrorStack &err=ErrorStack());
82 };
83 
84 #endif // OPENGD77CALLSIGNDB_HH
Controls the selection of callsigns from the UserDatabase to be encoded into the callsign db.
Definition: callsigndb.hh:20
Abstract base class of all callsign database implementations.
Definition: callsigndb.hh:14
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Represents and encodes the binary format for the call-sign database within the radio.
Definition: opengd77_callsigndb.hh:20
virtual bool encode(UserDatabase *calldb, const Selection &selection=Selection(), const ErrorStack &err=ErrorStack())
Encodes as many entries as possible of the given user-database.
Definition: opengd77_callsigndb.cc:91
OpenGD77CallsignDB(QObject *parent=nullptr)
Constructor.
Definition: opengd77_callsigndb.cc:80
virtual ~OpenGD77CallsignDB()
Destructor.
Definition: opengd77_callsigndb.cc:86
Represents the user information within the UserDatabase.
Definition: userdatabase.hh:28
Auto-updating DMR user database.
Definition: userdatabase.hh:23
Represents a user-db entry within the binary codeplug.
Definition: opengd77_callsigndb.hh:28
uint32_t number
DMR ID stored in BCD little-endian.
Definition: opengd77_callsigndb.hh:29
Represents the binary call-sign database header.
Definition: opengd77_callsigndb.hh:57
uint8_t size
Fixed to 0x5d for 15 byte names.
Definition: opengd77_callsigndb.hh:59
uint8_t unused6
Unused, set to 0x00.
Definition: opengd77_callsigndb.hh:61
uint32_t count
Number of contacts in DB, 32bit little-endian.
Definition: opengd77_callsigndb.hh:62