libdrmconf  0.10.4
A library to program DMR radios.
Classes | Public Slots | Signals | Public Member Functions | List of all members
UserDatabase Class Reference

Auto-updating DMR user database. More...

#include <userdatabase.hh>

Inheritance diagram for UserDatabase:
Inheritance graph
[legend]
Collaboration diagram for UserDatabase:
Collaboration graph
[legend]

Classes

class  User
 Represents the user information within the UserDatabase. More...
 

Public Slots

void download ()
 Starts the download of the user database.
 

Signals

void loaded ()
 Gets emitted once the call-sign database has been loaded.
 
void error (const QString &msg)
 Gets emitted if the loading of the call-sign database fails.
 

Public Member Functions

 UserDatabase (unsigned updatePeriodDays=30, QObject *parent=nullptr)
 Constructs the user-database. More...
 
qint64 count () const
 Returns the number of users.
 
bool load ()
 Loads all entries from the downloaded user database.
 
bool load (const QString &filename)
 Loads all entries from the downloaded user database at the specified location.
 
void sortUsers (unsigned id)
 Sorts users with respect to the distance to the given ID.
 
void sortUsers (const QSet< unsigned > &ids)
 Sorts users with respect to the minimum distance to the given IDs.
 
const Useruser (int idx) const
 Returns the user with index idx.
 
unsigned dbAge () const
 Returns the age of the database in days.
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 Implements the QAbstractTableModel interface, returns the number of rows (number of entries).
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 Implements the QAbstractTableModel interface, returns the number of columns.
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 Implements the QAbstractTableModel interface, return the entry data.
 

Detailed Description

Auto-updating DMR user database.

This class represents the complete DMR user database. The user database gets downloaded from https://www.radioid.net/static/users.json and kept up-to-date by re-downloading it periodically (by default every 30 days). This user database gets used in the GUI application to help assemble private call contacts and to assemble so-called CSV callsign databases, that are programmable to some DMR radios to resolve the DMR ID to callsigns and names.

Constructor & Destructor Documentation

◆ UserDatabase()

UserDatabase::UserDatabase ( unsigned  updatePeriodDays = 30,
QObject *  parent = nullptr 
)
explicit

Constructs the user-database.

The constructor will download the current user database if it was not downloaded yet or if the downloaded version is older than updatePeriodDays days.


The documentation for this class was generated from the following files: