libdrmconf  0.11.3
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  GD77,
26  // TyT devices
27  MD390, MD380 = MD390, RT8 = MD390,
28  UV390, UV380 = UV390, RT3S = UV390,
29  MD2017, RT82 = MD2017,
30  // Anytone devices
31  D868UVE,
32  D868UV = D868UVE, // Actually a different device. Implement!
33  DMR6X2UV,
34  D878UV,
35  D878UVII,
36  D578UV,
37  // Baofeng/BTECH
38  DM1701, RT84 = DM1701
39  };
40 
41 public:
43  RadioInfo(Radio radio, const QString &name, const QString manufacturer,
44  const USBDeviceInfo &interface,
45  const QList<RadioInfo> &alias=QList<RadioInfo>());
47  RadioInfo(Radio radio, const QString &key, const QString &name, const QString manufacturer,
48  const USBDeviceInfo &interface,
49  const QList<RadioInfo> &alias=QList<RadioInfo>());
50 
52  RadioInfo();
53 
55  bool isValid() const;
56 
58  const QString &key() const;
60  const QString &name() const;
62  const QString &manufacturer() const;
64  const USBDeviceInfo &interface() const;
65 
68  bool hasAlias() const;
70  const QList<RadioInfo> &alias() const;
71 
73  Radio id() const;
74 
75 public:
77  static bool hasRadioKey(const QString &key);
79  static RadioInfo byKey(const QString &key);
81  static RadioInfo byID(Radio radio);
82 
84  static QList<RadioInfo> allRadios(bool flat=true);
86  static QList<RadioInfo> allRadios(const USBDeviceInfo &interface, bool flat=true);
87 
88 protected:
92  QString _key;
94  QString _name;
96  QString _manufacturer;
98  QList<RadioInfo> _alias;
101 
102 protected:
104  static QHash<QString, Radio> _radiosByName;
106  static QHash<unsigned, RadioInfo> _radiosById;
107 };
108 
109 
110 #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 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:106
static RadioInfo byID(Radio radio)
Returns the radio info by id.
Definition: radioinfo.cc:139
Radio id() const
Returns the unique device ID (alias radios share ID).
Definition: radioinfo.cc:122
static QHash< QString, Radio > _radiosByName
Key->ID map.
Definition: radioinfo.hh:104
QString _name
Holds the name of the radio.
Definition: radioinfo.hh:94
QList< RadioInfo > _alias
Holds possible identical radios from other manufacturers.
Definition: radioinfo.hh:98
static QList< RadioInfo > allRadios(bool flat=true)
Returns the list of all known radios.
Definition: radioinfo.cc:144
const USBDeviceInfo & interface() const
Returns some information about the interface to the radio.
Definition: radioinfo.cc:108
const QString & key() const
Returns the radio key (used to identify radios in the command line).
Definition: radioinfo.cc:93
bool isValid() const
Returns true if the info is valid.
Definition: radioinfo.cc:88
Radio _radio
Holds the radio id.
Definition: radioinfo.hh:90
static RadioInfo byKey(const QString &key)
Returns the radio info by key.
Definition: radioinfo.cc:132
QString _manufacturer
Holds the name of the manufacturer.
Definition: radioinfo.hh:96
QString _key
Holds the key of the radio.
Definition: radioinfo.hh:92
static bool hasRadioKey(const QString &key)
Returns true if the given key is known.
Definition: radioinfo.cc:127
bool hasAlias() const
Returns true if the radio has aliases.
Definition: radioinfo.cc:113
const QString & manufacturer() const
Returns the manufacturer name.
Definition: radioinfo.cc:103
RadioInfo()
Empty constructor.
Definition: radioinfo.cc:81
USBDeviceInfo _interface
Holds some information about the interface to the radio.
Definition: radioinfo.hh:100
const QList< RadioInfo > & alias() const
Returns the list of alias radios.
Definition: radioinfo.cc:117
const QString & name() const
Returns the radio name.
Definition: radioinfo.cc:98
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