From ea83632880565b8b93524fdeb271fff6bb649513 Mon Sep 17 00:00:00 2001 From: Hannes Matuschek Date: Sat, 24 Apr 2021 13:02:28 +0200 Subject: [PATCH] Renamed callsign db impl. d878->d868. Enabled callsign db for d868. --- cli/encodecallsigndb.cc | 6 +++--- lib/CMakeLists.txt | 8 ++++---- lib/d868uv.cc | 6 +++--- lib/d868uv.hh | 4 ++-- ...78uv_callsigndb.cc => d868uv_callsigndb.cc} | 18 +++++++++--------- ...78uv_callsigndb.hh => d868uv_callsigndb.hh} | 14 +++++++------- lib/d878uv.hh | 5 +++-- 7 files changed, 31 insertions(+), 30 deletions(-) rename lib/{d878uv_callsigndb.cc => d868uv_callsigndb.cc} (93%) rename lib/{d878uv_callsigndb.hh => d868uv_callsigndb.hh} (93%) diff --git a/cli/encodecallsigndb.cc b/cli/encodecallsigndb.cc index df001078..49318c3d 100644 --- a/cli/encodecallsigndb.cc +++ b/cli/encodecallsigndb.cc @@ -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" @@ -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) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index f40ae161..eddfa10f 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -14,8 +14,8 @@ 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 @@ -23,8 +23,8 @@ SET(libdmrconf_MOC_HEADERS 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) diff --git a/lib/d868uv.cc b/lib/d868uv.cc index bb94ffd4..45cc0043 100644 --- a/lib/d868uv.cc +++ b/lib/d868uv.cc @@ -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 }; @@ -395,6 +395,6 @@ D868UV::uploadCallsigns() { emit uploadProgress(float(blkWritten*100)/totalBlocks); } } - //_codeplug.write("debug_codeplug.dfu"); + return true; } diff --git a/lib/d868uv.hh b/lib/d868uv.hh index 50d472f1..43e10719 100644 --- a/lib/d868uv.hh +++ b/lib/d868uv.hh @@ -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. @@ -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__ diff --git a/lib/d878uv_callsigndb.cc b/lib/d868uv_callsigndb.cc similarity index 93% rename from lib/d878uv_callsigndb.cc rename to lib/d868uv_callsigndb.cc index 8784e96d..5e2e92a8 100644 --- a/lib/d878uv_callsigndb.cc +++ b/lib/d868uv_callsigndb.cc @@ -1,4 +1,4 @@ -#include "d878uv_callsigndb.hh" +#include "d868uv_callsigndb.hh" #include "utils.hh" #include @@ -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); @@ -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 @@ -66,17 +66,17 @@ 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); } @@ -84,14 +84,14 @@ D878UVCallsignDB::limits_t::setTotalSize(uint32_t 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 diff --git a/lib/d878uv_callsigndb.hh b/lib/d868uv_callsigndb.hh similarity index 93% rename from lib/d878uv_callsigndb.hh rename to lib/d868uv_callsigndb.hh index 983bbf5c..795b2884 100644 --- a/lib/d878uv_callsigndb.hh +++ b/lib/d868uv_callsigndb.hh @@ -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. * @@ -19,7 +19,7 @@ * * * @ingroup d878uv */ -class D878UVCallsignDB : public CallsignDB +class D868UVCallsignDB : public CallsignDB { Q_OBJECT @@ -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. * @@ -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 diff --git a/lib/d878uv.hh b/lib/d878uv.hh index bb48b27e..6d2930e1 100644 --- a/lib/d878uv.hh +++ b/lib/d878uv.hh @@ -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. @@ -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__