libdrmconf 0.14.1
A library to program DMR radios.
Loading...
Searching...
No Matches
radio.hh
1
7
8#ifndef RADIO_HH
9#define RADIO_HH
10
11#include <QThread>
12#include "radioinfo.hh"
13#include "radiointerface.hh"
14#include "codeplug.hh"
15#include "userdatabase.hh"
16#include "callsigndb.hh"
17#include "errorstack.hh"
18#include "config.hh"
19
20class RadioLimits;
21
22
31class Radio : public QThread
32{
33 Q_OBJECT
34
35public:
45
46public:
48 explicit Radio(QObject *parent = nullptr);
49
50 virtual ~Radio();
51
53 virtual const QString &name() const = 0;
54
60 virtual const RadioLimits &limits() const = 0;
61
63 virtual const Codeplug &codeplug() const = 0;
65 virtual Codeplug &codeplug() = 0;
66
68 virtual const CallsignDB *callsignDB() const;
70 virtual CallsignDB *callsignDB();
71
73 Status status() const;
74
77 const ErrorStack &errorStack() const;
78
79public:
82 static Radio *detect(const USBDeviceDescriptor &descr, const RadioInfo &force=RadioInfo(),
83 const ErrorStack &err=ErrorStack());
84
85public slots:
89 virtual bool startDownload(const TransferFlags &flags, const ErrorStack &err=ErrorStack()) = 0;
90
93 virtual bool startUpload(
94 Config *config, const Codeplug::Flags &flags = Codeplug::Flags(),
95 const ErrorStack &err=ErrorStack()) = 0;
96
99 UserDatabase *db, const CallsignDB::Flags &selection=CallsignDB::Flags(),
100 const ErrorStack &err=ErrorStack()) = 0;
101
104 SatelliteDatabase *db, const TransferFlags &flags, const ErrorStack &err=ErrorStack()) = 0;
105
106signals:
110 void downloadProgress(int percent);
114 void downloadError(Radio *radio);
115
119 void uploadProgress(int percent);
121 void uploadError(Radio *radio);
123 void uploadComplete(Radio *radio);
124
125protected:
130};
131
132#endif // RADIO_HH
Controls the selection of callsigns from the UserDatabase to be encoded into the callsign db.
Definition callsigndb.hh:22
Abstract base class of all callsign database implementations.
Definition callsigndb.hh:16
Certain flags passed to CodePlug::encode to control the transfer and encoding of the codeplug.
Definition codeplug.hh:24
This class defines the interface all device-specific code-plugs must implement.
Definition codeplug.hh:18
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:43
Provides some information about a radio model.
Definition radioinfo.hh:16
Represents the limits or the entire codeplug.
Definition radiolimits.hh:755
Base class for all Radio objects.
Definition radio.hh:32
virtual bool startDownload(const TransferFlags &flags, const ErrorStack &err=ErrorStack())=0
Starts the download of the codeplug.
void uploadProgress(int percent)
Gets emitted on upload progress (e.g., for progress bars).
virtual Codeplug & codeplug()=0
Returns the codeplug instance.
Status status() const
Returns the current status.
Definition radio.cc:225
void uploadError(Radio *radio)
Gets emitted if there was an error during the upload.
void uploadComplete(Radio *radio)
Gets emitted once the codeplug upload has been completed successfully.
virtual const QString & name() const =0
Returns the name of the radio (e.g., device identifier).
virtual bool startUploadCallsignDB(UserDatabase *db, const CallsignDB::Flags &selection=CallsignDB::Flags(), const ErrorStack &err=ErrorStack())=0
Assembles the callsign DB from the given one and uploads it to the device.
static Radio * detect(const USBDeviceDescriptor &descr, const RadioInfo &force=RadioInfo(), const ErrorStack &err=ErrorStack())
Tries to detect the radio connected to the specified interface or constructs the specified radio usin...
Definition radio.cc:57
const ErrorStack & errorStack() const
Returns the error stack, passed to startDownload, startUpload or startUploadCallsignDB.
Definition radio.cc:230
void downloadError(Radio *radio)
Gets emitted if there was an error during the codeplug download.
void uploadStarted()
Gets emitted once the codeplug upload has been started.
virtual bool startUploadSatelliteConfig(SatelliteDatabase *db, const TransferFlags &flags, const ErrorStack &err=ErrorStack())=0
Assembles the satellite config and writes it to the device.
virtual const Codeplug & codeplug() const =0
Returns the codeplug instance.
void downloadFinished(Radio *radio, Codeplug *codeplug)
Gets emitted once the codeplug download has been finished.
void downloadStarted()
Gets emitted once the codeplug download has been started.
Status
Possible states of the radio object.
Definition radio.hh:37
@ StatusError
An error occurred.
Definition radio.hh:43
@ StatusDownload
Downloading codeplug.
Definition radio.hh:39
@ StatusIdle
Idle, nothing to do.
Definition radio.hh:38
@ StatusUpload
Uploading codeplug.
Definition radio.hh:40
@ StatusUploadSatellites
Uploading satellite config.
Definition radio.hh:42
@ StatusUploadCallsigns
Uploading codeplug.
Definition radio.hh:41
Status _task
The current state/task.
Definition radio.hh:127
Radio(QObject *parent=nullptr)
Default constructor.
Definition radio.cc:35
ErrorStack _errorStack
The error stack.
Definition radio.hh:129
virtual bool startUpload(Config *config, const Codeplug::Flags &flags=Codeplug::Flags(), const ErrorStack &err=ErrorStack())=0
Derives the device-specific codeplug from the generic configuration and uploads that codeplug to the ...
void downloadProgress(int percent)
Gets emitted on download progress (e.g., for progress bars).
virtual const CallsignDB * callsignDB() const
Returns the call-sign DB instance.
Definition radio.cc:46
virtual const RadioLimits & limits() const =0
Returns the limits for this radio.
A table holding all known satellites.
Definition satellitedatabase.hh:108
Controls the transfer of codeplugs, callsign DBs etc to the device.
Definition transferflags.hh:7
Base class for all radio interface descriptors representing a unique interface to a connected radio.
Definition usbdevice.hh:197
Auto-updating DMR user database.
Definition userdatabase.hh:24