libdrmconf  0.12.0
A library to program DMR radios.
radioinfo.hh
1 #ifndef RADIOINFO_HH
2 #define RADIOINFO_HH
3 
4 #include <QString>
5 #include <QHash>
6 #include <QList>
7 #include "usbdevice.hh"
8 
9 
15 class RadioInfo
16 {
17 public:
19  enum Radio {
20  // Open source firmware
21  OpenGD77,
22  OpenRTX,
23  // Radioddity devices
24  RD5R,
25  GD73,
26  GD77,
27  // TyT devices
28  MD390, MD380 = MD390, RT8 = MD390,
29  UV390, UV380 = UV390, RT3S = UV390,
30  MD2017, RT82 = MD2017,
31  // Anytone devices
32  D868UVE,
33  D868UV = D868UVE, // Actually a different device. Implement!
34  DMR6X2UV,
35  D878UV,
36  D878UVII,
37  D578UV,
38  // Baofeng/BTECH
39  DM1701, RT84 = DM1701,
40  DR1801UV
41  };
42 
43 public:
45  RadioInfo(Radio radio, const QString &name, const QString manufacturer,
46  const USBDeviceInfo &interface,
47  const QList<RadioInfo> &alias=QList<RadioInfo>());
49  RadioInfo(Radio radio, const QString &key, const QString &name, const QString manufacturer,
50  const USBDeviceInfo &interface,
51  const QList<RadioInfo> &alias=QList<RadioInfo>());
52 
54  RadioInfo();
55 
57  bool isValid() const;
58 
60  const QString &key() const;
62  const QString &name() const;
64  const QString &manufacturer() const;
66  const USBDeviceInfo &interface() const;
67 
70  bool hasAlias() const;
72  const QList<RadioInfo> &alias() const;
73 
75  Radio id() const;
76 
77 public:
79  static bool hasRadioKey(const QString &key);
81  static RadioInfo byKey(const QString &key);
83  static RadioInfo byID(Radio radio);
84 
86  static QList<RadioInfo> allRadios(bool flat=true);
88  static QList<RadioInfo> allRadios(const USBDeviceInfo &interface, bool flat=true);
89 
90 protected:
94  QString _key;
96  QString _name;
98  QString _manufacturer;
100  QList<RadioInfo> _alias;
103 
104 protected:
106  static QHash<QString, Radio> _radiosByName;
108  static QHash<unsigned, RadioInfo> _radiosById;
109 };
110 
111 
112 #endif // RADIOINFO_HH
Implements an interface to Anytone AT-D578UV VHF/UHF 50W DMR (Tier I & II) radios.
Definition: d578uv.hh:19
Implements an interface to Anytone AT-D868UV VHF/UHF 7W DMR (Tier I & II) radios.
Definition: d868uv.hh:36
Implements an interface to Anytone AT-D878UV VHF/UHF 7W DMR (Tier I & II) radios.
Definition: d878uv.hh:36
Implements an USB interface to the Baofeng DM-1701 and Retevis RT84 VHF/UHF 5W DMR (Tier I&II) radios...
Definition: dm1701.hh:39
Represents a BTECH DMR-6X2UV.
Definition: dmr6x2uv.hh:22
Implements the BTECH DR-1801UV (BF-1801 A6).
Definition: dr1801uv.hh:20
Implements an USB interface to the Radioddity GD-73 UHF 2W DMR (Tier I&II) radio.
Definition: gd73.hh:22
Implements an USB interface to the Radioddity GD-77(S) VHF/UHF 5W DMR (Tier I&II) radios.
Definition: gd77.hh:22
Implements an USB interface to the TYT MD-2017 & Retevis RT82 VHF/UHF 5W DMR (Tier I&II) radios.
Definition: md2017.hh:36
Implements an USB interface to the TYT MD-390 VHF/UHF 5W DMR (Tier I&II) radio.
Definition: md390.hh:32
Implements an USB interface to Open GD-77(S) VHF/UHF 5W DMR (Tier I&II) radios.
Definition: opengd77.hh:18
Implements an USB interface to radios running the Open RTX firmware.
Definition: openrtx.hh:18
Implements an interface to the Baofeng/Radioddity RD-5R VHF/UHF 5W DMR (Tier I/II) radio.
Definition: rd5r.hh:37
Provides some information about a radio model.
Definition: radioinfo.hh:16
static QHash< unsigned, RadioInfo > _radiosById
ID->Info map.
Definition: radioinfo.hh:108
static RadioInfo byID(Radio radio)
Returns the radio info by id.
Definition: radioinfo.cc:145
Radio id() const
Returns the unique device ID (alias radios share ID).
Definition: radioinfo.cc:128
static QHash< QString, Radio > _radiosByName
Key->ID map.
Definition: radioinfo.hh:106
QString _name
Holds the name of the radio.
Definition: radioinfo.hh:96
QList< RadioInfo > _alias
Holds possible identical radios from other manufacturers.
Definition: radioinfo.hh:100
static QList< RadioInfo > allRadios(bool flat=true)
Returns the list of all known radios.
Definition: radioinfo.cc:150
const USBDeviceInfo & interface() const
Returns some information about the interface to the radio.
Definition: radioinfo.cc:114
const QString & key() const
Returns the radio key (used to identify radios in the command line).
Definition: radioinfo.cc:99
bool isValid() const
Returns true if the info is valid.
Definition: radioinfo.cc:94
Radio _radio
Holds the radio id.
Definition: radioinfo.hh:92
static RadioInfo byKey(const QString &key)
Returns the radio info by key.
Definition: radioinfo.cc:138
QString _manufacturer
Holds the name of the manufacturer.
Definition: radioinfo.hh:98
QString _key
Holds the key of the radio.
Definition: radioinfo.hh:94
static bool hasRadioKey(const QString &key)
Returns true if the given key is known.
Definition: radioinfo.cc:133
bool hasAlias() const
Returns true if the radio has aliases.
Definition: radioinfo.cc:119
const QString & manufacturer() const
Returns the manufacturer name.
Definition: radioinfo.cc:109
RadioInfo()
Empty constructor.
Definition: radioinfo.cc:87
USBDeviceInfo _interface
Holds some information about the interface to the radio.
Definition: radioinfo.hh:102
const QList< RadioInfo > & alias() const
Returns the list of alias radios.
Definition: radioinfo.cc:123
const QString & name() const
Returns the radio name.
Definition: radioinfo.cc:104
Base class for all Radio objects.
Definition: radio.hh:32
Generic information about a possible radio interface.
Definition: usbdevice.hh:121
Implements an USB interface to the TYT MD-UV390 & Retevis RT3S VHF/UHF 5W DMR (Tier I&II) radios.
Definition: uv390.hh:37