libdrmconf 0.12.1
A library to program DMR radios.
Loading...
Searching...
No Matches
gd77_callsigndb.hh
1#ifndef GD77CALLSIGNDB_HH
2#define GD77CALLSIGNDB_HH
3
4#include "callsigndb.hh"
5#include "userdatabase.hh"
6
25{
26 Q_OBJECT
27
28public:
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
72public:
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
CallsignDB(QObject *parent=nullptr)
Hidden constructor.
Definition callsigndb.cc:45
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:41
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
void clear()
Resets the entry.
Definition gd77_callsigndb.cc:23
char name[8]
Call or name, up to 8 ASCII chars, 0x00 padded.
Definition gd77_callsigndb.hh:32
void setName(const QString &name)
Sets the name of the entry.
Definition gd77_callsigndb.cc:41
uint32_t number
DMR ID stored in BCD little-endian.
Definition gd77_callsigndb.hh:31
uint32_t getNumber() const
Returns the DMR ID for the entry.
Definition gd77_callsigndb.cc:28
void setNumber(uint32_t number)
Sets the DMR ID for the entry.
Definition gd77_callsigndb.cc:32
void fromEntry(const UserDatabase::User &user)
Constructs an entry from the given user.
Definition gd77_callsigndb.cc:46
userdb_entry_t()
Constructor.
Definition gd77_callsigndb.cc:18
QString getName() const
Returns the name of the entry.
Definition gd77_callsigndb.cc:37
char magic[8]
Fixed string 'ID-V001\0'.
Definition gd77_callsigndb.hh:59
void setSize(uint32_t n)
Sets the number of entries in the call-sign DB.
Definition gd77_callsigndb.cc:67
uint32_t count
Number of contacts in DB, 32bit little-endian.
Definition gd77_callsigndb.hh:60
void clear()
Resets the header.
Definition gd77_callsigndb.cc:61
userdb_t()
Constructor.
Definition gd77_callsigndb.cc:56