libdrmconf  0.10.4
A library to program DMR radios.
gd77_callsigndb.hh
1 #ifndef GD77CALLSIGNDB_HH
2 #define GD77CALLSIGNDB_HH
3 
4 #include "callsigndb.hh"
5 #include "userdatabase.hh"
6 
24 class GD77CallsignDB : public CallsignDB
25 {
26  Q_OBJECT
27 
28 public:
30  struct __attribute__((packed)) userdb_entry_t {
31  uint32_t number;
32  char name[8];
33 
37  void clear();
38 
40  uint32_t getNumber() const;
42  void setNumber(uint32_t number);
43 
45  QString getName() const;
47  void setName(const QString &name);
48 
50  void fromEntry(const UserDatabase::User &user);
51  };
52 
58  struct __attribute__((packed)) userdb_t {
59  char magic[8];
60  uint32_t count;
61 
63  userdb_t();
65  void clear();
66 
68  void setSize(uint32_t n);
69  };
70 
71 
72 public:
74  explicit GD77CallsignDB(QObject *parent=nullptr);
76  virtual ~GD77CallsignDB();
77 
79  virtual bool encode(UserDatabase *calldb, const Selection &selection=Selection(),
80  const ErrorStack &err=ErrorStack());
81 };
82 
83 #endif // GD77CALLSIGNDB_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: gd77_callsigndb.hh:25
virtual ~GD77CallsignDB()
Destructor.
Definition: gd77_callsigndb.cc:81
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: gd77_callsigndb.cc:86
GD77CallsignDB(QObject *parent=nullptr)
Constructor.
Definition: gd77_callsigndb.cc:75
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: gd77_callsigndb.hh:30
uint32_t number
DMR ID stored in BCD little-endian.
Definition: gd77_callsigndb.hh:31
Represents the binary call-sign database header.
Definition: gd77_callsigndb.hh:58
uint32_t count
Number of contacts in DB, 32bit little-endian.
Definition: gd77_callsigndb.hh:60