libdrmconf 0.12.1
A library to program DMR radios.
Loading...
Searching...
No Matches
d868uv_callsigndb.hh
1#ifndef D868UVCALLSIGNDB_HH
2#define D868UVCALLSIGNDB_HH
3
4#include "callsigndb.hh"
5#include "userdatabase.hh"
6#include "d868uv_codeplug.hh"
7
25{
26 Q_OBJECT
27
28public:
41 {
42 public:
44 enum class RingTone {
45 Off = 0,
46 Tone = 1,
47 Online = 2
48 };
49
50 protected:
52 EntryElement(uint8_t *ptr, unsigned size);
53
54 public:
56 explicit EntryElement(uint8_t *ptr);
57
58 void clear();
59
61 virtual void setCallType(DMRContact::Type type);
63 virtual void setNumber(unsigned num);
65 virtual void setFriendFlag(bool set);
67 virtual void setRingTone(RingTone tone);
69 virtual void setContent(const QString &name, const QString &city, const QString &call,
70 const QString &state, const QString &country, const QString &comment);
71
74 virtual unsigned fromUser(const UserDatabase::User &user);
75
77 static unsigned size(const UserDatabase::User &user);
78 };
79
82 {
83 protected:
85 EntryBankElement(uint8_t *ptr, unsigned size);
86
87 public:
89 explicit EntryBankElement(uint8_t *ptr);
90
92 static constexpr unsigned int size() { return 0x000186a0; }
93
94 void clear();
95
97 uint8_t *entry(unsigned int i) const;
98 };
99
103
106 {
107 protected:
109 IndexBankElement(uint8_t *ptr, unsigned size);
110
111 public:
113 explicit IndexBankElement(uint8_t *ptr);
114
116 static constexpr unsigned int size() { return 0x0001f400; }
117
118 void clear();
119
121 uint8_t *entry(unsigned int i) const;
122 };
123
129 {
130 protected:
132 LimitsElement(uint8_t *ptr, unsigned size);
133
134 public:
136 LimitsElement(uint8_t *ptr);
137
139 void clear();
140
142 virtual unsigned count() const;
144 virtual void setCount(unsigned count);
145
147 virtual unsigned endOfDB() const;
149 virtual void setEndOfDB(unsigned addr);
151 virtual void setTotalSize(unsigned size);
152
153 public:
155 static unsigned size();
156 };
157
158
159public:
161 explicit D868UVCallsignDB(QObject *parent=nullptr);
162
164 bool encode(UserDatabase *db, const Selection &selection=Selection(),
165 const ErrorStack &err=ErrorStack());
166
167public:
169 struct Limit {
171 static constexpr unsigned int entries() { return 200000; }
172 };
173
174protected:
176 struct Offset {
178 static constexpr unsigned int index() { return 0x04000000; }
179 static constexpr unsigned int betweenIndexBanks() { return 0x00040000; }
180 static constexpr unsigned int callsigns() { return 0x04500000; }
181 static constexpr unsigned int betweenCallsignBanks() { return 0x00040000; }
182 static constexpr unsigned int limits() { return 0x044C0000; }
184 };
185};
186
187#endif // D868UVCALLSIGNDB_HH
Represents the base class for entries to the contact indices in all AnyTone codeplugs.
Definition anytone_codeplug.hh:2927
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
Represents the abstract base class of all codeplug elements.
Definition codeplug.hh:52
Represents a bank of call-sign DB entries.
Definition d868uv_callsigndb.hh:82
EntryBankElement(uint8_t *ptr)
Constructor.
void clear()
Abstract method to reset the element within the codeplug.
EntryBankElement(uint8_t *ptr, unsigned size)
Hidden constructor.
static constexpr unsigned int size()
The size of the element.
Definition d868uv_callsigndb.hh:92
uint8_t * entry(unsigned int i) const
Returns the i-th element of the bank.
Represents the header of an entry in the callsign database.
Definition d868uv_callsigndb.hh:41
virtual void setNumber(unsigned num)
Sets the DMR ID number.
Definition d868uv_callsigndb.cc:38
EntryElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition d868uv_callsigndb.cc:10
virtual void setRingTone(RingTone tone)
Sets the ring tone.
Definition d868uv_callsigndb.cc:48
virtual void setCallType(DMRContact::Type type)
Sets the call type.
Definition d868uv_callsigndb.cc:29
virtual void setContent(const QString &name, const QString &city, const QString &call, const QString &state, const QString &country, const QString &comment)
Sets the entry content.
Definition d868uv_callsigndb.cc:53
virtual void setFriendFlag(bool set)
Set/clear friend flag.
Definition d868uv_callsigndb.cc:43
RingTone
Notification tones for callsign entry.
Definition d868uv_callsigndb.hh:44
virtual unsigned fromUser(const UserDatabase::User &user)
Constructs a database entry from the given user.
Definition d868uv_callsigndb.cc:67
void clear()
Abstract method to reset the element within the codeplug.
Definition d868uv_callsigndb.cc:23
Represents a bank of index entries.
Definition d868uv_callsigndb.hh:106
IndexBankElement(uint8_t *ptr, unsigned size)
Hidden constructor.
uint8_t * entry(unsigned int i) const
Returns the i-th element of the bank.
void clear()
Abstract method to reset the element within the codeplug.
static constexpr unsigned int size()
The size of the element.
Definition d868uv_callsigndb.hh:116
IndexBankElement(uint8_t *ptr)
Constructor.
Stores some basic limits of the callsign db.
Definition d868uv_callsigndb.hh:129
virtual void setCount(unsigned count)
Sets the number of entries.
Definition d868uv_callsigndb.cc:115
virtual void setTotalSize(unsigned size)
Sets the total size of the DB (updated end-of-db address).
Definition d868uv_callsigndb.cc:128
virtual unsigned endOfDB() const
Returns the end-of-db address.
Definition d868uv_callsigndb.cc:120
void clear()
Resets the limits.
Definition d868uv_callsigndb.cc:105
static unsigned size()
Returns the size of the encoded element.
Definition d868uv_callsigndb.cc:133
virtual void setEndOfDB(unsigned addr)
Sets the end-of-db address.
Definition d868uv_callsigndb.cc:124
virtual unsigned count() const
Returns the number of entries in the DB.
Definition d868uv_callsigndb.cc:111
LimitsElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition d868uv_callsigndb.cc:92
Represents and encodes the binary format for the call-sign database within a AnyTone AT-D868UV radio.
Definition d868uv_callsigndb.hh:25
bool encode(UserDatabase *db, const Selection &selection=Selection(), const ErrorStack &err=ErrorStack())
Tries to encode as many entries of the given user-database.
Definition d868uv_callsigndb.cc:148
D868UVCallsignDB(QObject *parent=nullptr)
Constructor, does not allocate any memory yet.
Definition d868uv_callsigndb.cc:141
D868UVCodeplug::ContactMapElement IndexEntryElement
Same index entry used by the codeplug to map normal digital contacts to an contact index.
Definition d868uv_callsigndb.hh:102
uint32_t size() const
Returns the total size of the DFU file.
Definition dfufile.cc:52
Type
Possible call types for a contact.
Definition contact.hh:155
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:41
Represents the user information within the UserDatabase.
Definition userdatabase.hh:28
Auto-updating DMR user database.
Definition userdatabase.hh:23
Some limits for the call-sign DB.
Definition d868uv_callsigndb.hh:169
static constexpr unsigned int entries()
Specifies the max number of entries in the DB.
Definition d868uv_callsigndb.hh:171
Some internal used offsets within the DB.
Definition d868uv_callsigndb.hh:176