libdrmconf  0.12.0
A library to program DMR radios.
anytone_radio.hh
1 
10 #ifndef __ANYTONE_RADIO_HH__
11 #define __ANYTONE_RADIO_HH__
12 
13 #include "radio.hh"
14 #include "anytone_interface.hh"
15 #include "anytone_codeplug.hh"
16 
33 class AnytoneRadio: public Radio
34 {
35  Q_OBJECT
36 
37 protected:
39  explicit AnytoneRadio(const QString &name, AnytoneInterface *device=nullptr, QObject *parent=nullptr);
40 
41 public:
43  virtual ~AnytoneRadio();
44 
45  const QString &name() const;
46  const Codeplug &codeplug() const;
47  Codeplug &codeplug();
48 
49 public slots:
51  bool startDownload(bool blocking=false, const ErrorStack &err=ErrorStack());
54  bool startUpload(Config *config, bool blocking=false,
55  const Codeplug::Flags &flags = Codeplug::Flags(), const ErrorStack &err=ErrorStack());
57  bool startUploadCallsignDB(UserDatabase *db, bool blocking=false,
58  const CallsignDB::Selection &selection=CallsignDB::Selection(), const ErrorStack &err=ErrorStack());
59 
60 protected:
62  void run();
63 
64 private:
66  virtual bool download();
68  virtual bool upload();
71  virtual bool uploadCallsigns();
72 
73 protected:
75  QString _name;
89 };
90 
91 #endif // __D868UV_HH__
Base class interface for all Anytone radio codeplugs.
Definition: anytone_codeplug.hh:20
Implements the interface to Anytone D868UV, D878UV, etc radios.
Definition: anytone_interface.hh:15
Implements an interface to Anytone radios.
Definition: anytone_radio.hh:34
Codeplug::Flags _codeplugFlags
If true, the codeplug on the radio gets updated upon upload.
Definition: anytone_radio.hh:80
AnytoneRadio(const QString &name, AnytoneInterface *device=nullptr, QObject *parent=nullptr)
Do not construct this class directly.
Definition: anytone_radio.cc:12
void run()
Thread main routine, performs all blocking IO operations for codeplug up- and download.
Definition: anytone_radio.cc:126
bool startUpload(Config *config, bool blocking=false, const Codeplug::Flags &flags=Codeplug::Flags(), const ErrorStack &err=ErrorStack())
Derives the device-specific codeplug from the generic configuration and uploads that codeplug to the ...
Definition: anytone_radio.cc:71
Config * _config
Owns the generic configuration.
Definition: anytone_radio.hh:82
UserDatabase * _userDB
A weak reference to the user-database.
Definition: anytone_radio.hh:84
AnytoneCodeplug * _codeplug
The actual binary codeplug representation.
Definition: anytone_radio.hh:86
const QString & name() const
Returns the name of the radio (e.g., device identifier).
Definition: anytone_radio.cc:35
CallsignDB * _callsigns
The actual binary callsign database representation.
Definition: anytone_radio.hh:88
AnytoneInterface * _dev
The interface to the radio.
Definition: anytone_radio.hh:77
const Codeplug & codeplug() const
Returns the codeplug instance.
Definition: anytone_radio.cc:40
virtual ~AnytoneRadio()
Destructor.
Definition: anytone_radio.cc:23
bool startDownload(bool blocking=false, const ErrorStack &err=ErrorStack())
Starts the download of the codeplug and derives the generic configuration from it.
Definition: anytone_radio.cc:50
QString _name
The device identifier.
Definition: anytone_radio.hh:75
bool startUploadCallsignDB(UserDatabase *db, bool blocking=false, const CallsignDB::Selection &selection=CallsignDB::Selection(), const ErrorStack &err=ErrorStack())
Encodes the given user-database and uploades it to the device.
Definition: anytone_radio.cc:103
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
Certain flags passed to CodePlug::encode to control the transfer and encoding of the codeplug.
Definition: codeplug.hh:25
This class defines the interface all device-specific code-plugs must implement.
Definition: codeplug.hh:19
The config class, representing the codeplug configuration.
Definition: config.hh:70
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Base class for all Radio objects.
Definition: radio.hh:32
Auto-updating DMR user database.
Definition: userdatabase.hh:23