Skip to content

Commit

Permalink
Renamed callsign db impl. d878->d868. Enabled callsign db for d868.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmatuschek committed Apr 24, 2021
1 parent 2a0833b commit ea83632
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 30 deletions.
6 changes: 3 additions & 3 deletions cli/encodecallsigndb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "config.hh"
#include "uv390_callsigndb.hh"
#include "opengd77_callsigndb.hh"
#include "d878uv_callsigndb.hh"
#include "d868uv_callsigndb.hh"
#include "crc32.hh"


Expand Down Expand Up @@ -81,8 +81,8 @@ int encodeCallsignDB(QCommandLineParser &parser, QCoreApplication &app) {
<< "': " << db.errorMessage();
return -1;
}
} else if ("d878uv"==parser.value("radio").toLower()) {
D878UVCallsignDB db;
} else if (("d878uv"==parser.value("radio").toLower()) || ("d868uv"==parser.value("radio").toLower()) ){
D868UVCallsignDB db;
db.encode(&userdb, selection);
if (! db.write(parser.positionalArguments().at(1))) {
logError() << "Cannot write output call-sign DB file '" << parser.positionalArguments().at(1)
Expand Down
8 changes: 4 additions & 4 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ SET(libdmrconf_SOURCES
roaming.cc callsigndb.cc talkgroupdatabase.cc radioid.cc
rd5r.cc rd5r_codeplug.cc uv390.cc uv390_codeplug.cc uv390_callsigndb.cc gd77.cc gd77_codeplug.cc
opengd77.cc opengd77_interface.cc opengd77_codeplug.cc opengd77_callsigndb.cc
anytone_interface.cc d878uv.cc d878uv_codeplug.cc d878uv_callsigndb.cc
d868uv.cc d868uv_codeplug.cc)
anytone_interface.cc d878uv.cc d878uv_codeplug.cc
d868uv.cc d868uv_codeplug.cc d868uv_callsigndb.cc)
SET(libdmrconf_MOC_HEADERS
radio.hh radiointerface.hh ${hid_HEADERS} hid_interface.hh dfu_libusb.hh usbserial.hh
csvreader.hh dfufile.hh repeaterdatabase.hh userdatabase.hh logger.hh
config.hh contact.hh rxgrouplist.hh channel.hh zone.hh scanlist.hh gpssystem.hh codeplug.hh
roaming.hh callsigndb.hh talkgroupdatabase.hh radioid.hh
rd5r.hh rd5r_codeplug.hh uv390.hh uv390_codeplug.hh uv390_callsigndb.hh gd77.hh gd77_codeplug.hh
opengd77.hh opengd77_interface.hh opengd77_codeplug.hh opengd77_callsigndb.hh
anytone_interface.hh d878uv.hh d878uv_codeplug.hh d878uv_callsigndb.hh
d868uv.hh d868uv_codeplug.hh)
anytone_interface.hh d878uv.hh d878uv_codeplug.hh
d868uv.hh d868uv_codeplug.hh d868uv_callsigndb.hh)
SET(libdmrconf_HEADERS libdmrconf.hh
utils.hh crc32.hh csvwriter.hh signaling.hh codeplugcontext.hh addressmap.hh)

Expand Down
6 changes: 3 additions & 3 deletions lib/d868uv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ static Radio::Features _d868uv_features =

// call-sign database limits
.hasCallsignDB = true, // hasCallsignDB
.callsignDBImplemented = false, // callsignDBImplemented
.maxCallsignsInDB = 0 // maxCallsignsInDB
.callsignDBImplemented = true, // callsignDBImplemented
.maxCallsignsInDB = 200000 // maxCallsignsInDB
};


Expand Down Expand Up @@ -395,6 +395,6 @@ D868UV::uploadCallsigns() {
emit uploadProgress(float(blkWritten*100)/totalBlocks);
}
}
//_codeplug.write("debug_codeplug.dfu");

return true;
}
4 changes: 2 additions & 2 deletions lib/d868uv.hh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "radio.hh"
#include "anytone_interface.hh"
#include "d868uv_codeplug.hh"
#include "d878uv_callsigndb.hh"
#include "d868uv_callsigndb.hh"


/** Implements an interface to Anytone AT-D868UV VHF/UHF 7W DMR (Tier I & II) radios.
Expand Down Expand Up @@ -85,7 +85,7 @@ protected:
/** The actual binary codeplug representation. */
D868UVCodeplug _codeplug;
/** The actual binary callsign database representation. */
D878UVCallsignDB _callsigns;
D868UVCallsignDB _callsigns;
};

#endif // __D868UV_HH__
18 changes: 9 additions & 9 deletions lib/d878uv_callsigndb.cc → lib/d868uv_callsigndb.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "d878uv_callsigndb.hh"
#include "d868uv_callsigndb.hh"
#include "utils.hh"
#include <QtEndian>

Expand All @@ -16,10 +16,10 @@


/* ******************************************************************************************** *
* Implementation of D878UVCallsignDB::enty_head_t
* Implementation of D868UVCallsignDB::enty_head_t
* ******************************************************************************************** */
size_t
D878UVCallsignDB::entry_t::fromUser(const UserDatabase::User &user) {
D868UVCallsignDB::entry_t::fromUser(const UserDatabase::User &user) {
call_type = PRIVATE_CALL;
ring = RING_NONE;
encode_dmr_id_bcd((uint8_t *)&id, user.id);
Expand Down Expand Up @@ -51,7 +51,7 @@ D878UVCallsignDB::entry_t::fromUser(const UserDatabase::User &user) {
}

size_t
D878UVCallsignDB::entry_t::getSize(const UserDatabase::User &user) {
D868UVCallsignDB::entry_t::getSize(const UserDatabase::User &user) {
return 6 // header
+ std::min(16, user.name.size())+1 // name
+ std::min(16, user.city.size())+1 // city
Expand All @@ -66,32 +66,32 @@ D878UVCallsignDB::entry_t::getSize(const UserDatabase::User &user) {
* Implementation of D878UVCallsignDB::limits_t
* ******************************************************************************************** */
void
D878UVCallsignDB::limits_t::clear() {
D868UVCallsignDB::limits_t::clear() {
count = end_of_db = _unused8 = _unused12 = 0;
}

void
D878UVCallsignDB::limits_t::setCount(uint32_t n) {
D868UVCallsignDB::limits_t::setCount(uint32_t n) {
count = qToLittleEndian(n);
}

void
D878UVCallsignDB::limits_t::setTotalSize(uint32_t size) {
D868UVCallsignDB::limits_t::setTotalSize(uint32_t size) {
end_of_db = qToLittleEndian(CALLSIGN_BANK0 + size);
}


/* ********************************************************************************************* *
* Implementation of D878UVCallsignDB
* ********************************************************************************************* */
D878UVCallsignDB::D878UVCallsignDB(QObject *parent)
D868UVCallsignDB::D868UVCallsignDB(QObject *parent)
: CallsignDB(parent)
{
// allocate and clear DB memory
addImage("AnyTone AT-D878UV Callsign database.");
}

bool D878UVCallsignDB::encode(UserDatabase *db, const Selection &selection) {
bool D868UVCallsignDB::encode(UserDatabase *db, const Selection &selection) {
// Determine size of call-sign DB in memory
qint64 n = std::min(db->count(), qint64(MAX_CALLSIGNS));
// If DB size is limited by settings
Expand Down
14 changes: 7 additions & 7 deletions lib/d878uv_callsigndb.hh → lib/d868uv_callsigndb.hh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef D878UVCALLSIGNDB_HH
#define D878UVCALLSIGNDB_HH
#ifndef D868UVCALLSIGNDB_HH
#define D868UVCALLSIGNDB_HH

#include "callsigndb.hh"
#include "d878uv_codeplug.hh"
#include "d868uv_codeplug.hh"

/** Represents and encodes the binary format for the call-sign database within the radio.
*
Expand All @@ -19,7 +19,7 @@
* </table>
*
* @ingroup d878uv */
class D878UVCallsignDB : public CallsignDB
class D868UVCallsignDB : public CallsignDB
{
Q_OBJECT

Expand Down Expand Up @@ -66,7 +66,7 @@ public:

/** Same index entry used by the codeplug to map normal digital contacts to an contact index. Here
* it maps to the byte offset within the database entries. */
typedef D878UVCodeplug::contact_map_t index_entry_t;
typedef D868UVCodeplug::contact_map_t index_entry_t;

/** Stores some basic limits of the callsign db.
*
Expand All @@ -90,10 +90,10 @@ public:

public:
/** Constructor, does not allocate any memory yet. */
explicit D878UVCallsignDB(QObject *parent=nullptr);
explicit D868UVCallsignDB(QObject *parent=nullptr);

/** Tries to encode as many entries of the given user-database. */
bool encode(UserDatabase *db, const Selection &selection=Selection());
};

#endif // D878UVCALLSIGNDB_HH
#endif // D868UVCALLSIGNDB_HH
5 changes: 3 additions & 2 deletions lib/d878uv.hh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#include "radio.hh"
#include "anytone_interface.hh"
#include "d878uv_codeplug.hh"
#include "d878uv_callsigndb.hh"
// uses same callsign db as 878
#include "d868uv_callsigndb.hh"


/** Implements an interface to Anytone AT-D878UV VHF/UHF 7W DMR (Tier I & II) radios.
Expand Down Expand Up @@ -85,7 +86,7 @@ protected:
/** The actual binary codeplug representation. */
D878UVCodeplug _codeplug;
/** The actual binary callsign database representation. */
D878UVCallsignDB _callsigns;
D868UVCallsignDB _callsigns;
};

#endif // __D878UV_HH__

0 comments on commit ea83632

Please sign in to comment.