libdrmconf 0.12.1
A library to program DMR radios.
Loading...
Searching...
No Matches
opengd77base_callsigndb.hh
1#ifndef OPENGD77BASECALLSIGNDB_HH
2#define OPENGD77BASECALLSIGNDB_HH
3
4#include "callsigndb.hh"
5#include "userdatabase.hh"
6
10{
11 Q_OBJECT
12
13public:
18 struct __attribute__((packed)) userdb_entry_t {
19 uint32_t number;
20 char name[15];
21
25 void clear();
26
28 uint32_t getNumber() const;
30 void setNumber(uint32_t number);
31
33 QString getName() const;
36 void setName(const QString &name);
37
39 void fromEntry(const UserDatabase::User &user);
40 };
41
47 struct __attribute__((packed)) userdb_t {
48 char magic[3];
49 uint8_t size;
50 char version[3];
51 uint8_t unused6;
52 uint32_t count;
53
55 userdb_t();
57 void clear();
59 void setSize(unsigned n);
60 };
61
62
63public:
65 explicit OpenGD77BaseCallsignDB(QObject *parent=nullptr);
68
70 virtual bool encode(UserDatabase *calldb, const Selection &selection=Selection(),
71 const ErrorStack &err=ErrorStack()) = 0;
72
73public:
75 struct Limit {
77 static constexpr unsigned int blockSize() { return 32; }
78 };
79};
80
81#endif // OPENGD77BASECALLSIGNDB_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 all call-sign databases within OpenGD77 radios.
Definition opengd77base_callsigndb.hh:10
virtual ~OpenGD77BaseCallsignDB()
Destructor.
Definition opengd77base_callsigndb.cc:79
OpenGD77BaseCallsignDB(QObject *parent=nullptr)
Constructor.
Definition opengd77base_callsigndb.cc:73
virtual bool encode(UserDatabase *calldb, const Selection &selection=Selection(), const ErrorStack &err=ErrorStack())=0
Encodes as many entries as possible of the given user-database.
Represents the user information within the UserDatabase.
Definition userdatabase.hh:28
Auto-updating DMR user database.
Definition userdatabase.hh:23
Some limits for this callsign DB.
Definition opengd77base_callsigndb.hh:75
static constexpr unsigned int blockSize()
Maximum block size.
Definition opengd77base_callsigndb.hh:77
Represents a user-db entry within the binary codeplug.
Definition opengd77base_callsigndb.hh:18
uint32_t number
DMR ID stored in BCD little-endian.
Definition opengd77base_callsigndb.hh:19
Represents the binary call-sign database header.
Definition opengd77base_callsigndb.hh:47
uint8_t size
Fixed to 0x5d for 15 byte names.
Definition opengd77base_callsigndb.hh:49
uint8_t unused6
Unused, set to 0x00.
Definition opengd77base_callsigndb.hh:51
uint32_t count
Number of contacts in DB, 32bit little-endian.
Definition opengd77base_callsigndb.hh:52