libdrmconf  0.10.4
A library to program DMR radios.
codeplugcontext.hh
1 #ifndef CODEPLUGCONTEXT_HH
2 #define CODEPLUGCONTEXT_HH
3 
4 #include <QHash>
5 #include "config.hh"
6 
16 {
17 public:
20 
22  Config *config() const;
23 
25  bool hasRadioId(int index) const;
27  bool setDefaultRadioId(uint32_t id, int index);
29  bool addRadioId(uint32_t id, int index, const QString &name="");
31  DMRRadioID *getRadioId(int idx) const;
32 
34  bool hasChannel(int index) const;
36  bool addChannel(Channel *ch, int index);
38  Channel *getChannel(int index) const;
39 
41  bool hasDigitalContact(int index) const;
43  bool addDigitalContact(DMRContact *con, int index);
45  DMRContact *getDigitalContact(int index) const;
46 
48  bool hasAnalogContact(int index) const;
50  bool addAnalogContact(DTMFContact *con, int index);
52  DTMFContact *getAnalogContact(int index) const;
53 
55  bool hasGroupList(int index) const;
57  bool addGroupList(RXGroupList *grp, int index);
59  RXGroupList *getGroupList(int index) const;
60 
62  bool hasScanList(int index) const;
64  bool addScanList(ScanList *lst, int index);
66  ScanList *getScanList(int index) const;
67 
69  bool hasGPSSystem(int index) const;
71  bool addGPSSystem(GPSSystem *sys, int index);
73  GPSSystem *getGPSSystem(int index) const;
74 
76  bool hasAPRSSystem(int index) const;
78  bool addAPRSSystem(APRSSystem *sys, int index);
80  APRSSystem *getAPRSSystem(int index) const;
81 
83  bool hasRoamingZone(int index) const;
85  bool addRoamingZone(RoamingZone *zone, int index);
87  RoamingZone *getRoamingZone(int index) const;
89  bool hasRoamingChannel(int index) const;
91  bool addRoamingChannel(DMRChannel *ch, int index);
93  DMRChannel *getRoamingChannel(int index) const;
94 
95 protected:
99  QHash<int, int> _radioIDTable;
101  QHash<int, int> _channelTable;
103  QHash<int, int> _digitalContactTable;
105  QHash<int, int> _analogContactTable;
107  QHash<int, int> _groupListTable;
109  QHash<int, int> _scanListTable;
111  QHash<int, int> _gpsSystemTable;
113  QHash<int, int> _aprsSystemTable;
115  QHash<int, int> _roamingZoneTable;
117  QHash<int, int> _roamingChannelTable;
118 };
119 
120 #endif // CODEPLUGCONTEXT_HH
Represents an APRS system within the generic config.
Definition: gpssystem.hh:130
The base class of all channels (analog and digital) of a codeplug configuration.
Definition: channel.hh:32
Helper class to assemble radio config from binary codeplugs that use index-tables and bitmaps to spec...
Definition: codeplugcontext.hh:16
QHash< int, int > _scanListTable
Maps a code-plug scan-list index to the scan-list index within the wrapped radio config.
Definition: codeplugcontext.hh:109
bool hasGroupList(int index) const
Returns true, if the given RX group list index has been defined before.
Definition: codeplugcontext.cc:126
GPSSystem * getGPSSystem(int index) const
Gets a GPS system for the specified index or nullptr if not defined.
Definition: codeplugcontext.cc:179
bool setDefaultRadioId(uint32_t id, int index)
Stores the given ID at the specified index as the default radio ID.
Definition: codeplugcontext.cc:24
QHash< int, int > _analogContactTable
Maps a code-plug analog-contact index to the contact index within the wrapped radio config.
Definition: codeplugcontext.hh:105
DMRChannel * getRoamingChannel(int index) const
Returns the roaming channel associated with the given index.
Definition: codeplugcontext.cc:251
bool hasDigitalContact(int index) const
Returns true, if the given digital contact index has been defined before.
Definition: codeplugcontext.cc:77
RoamingZone * getRoamingZone(int index) const
Returns the roaming zone associated with the given index.
Definition: codeplugcontext.cc:227
ScanList * getScanList(int index) const
Gets a scan list for the specified index or nullptr if not defined.
Definition: codeplugcontext.cc:155
bool addRadioId(uint32_t id, int index, const QString &name="")
Adds the given radio ID at the given index to the list.
Definition: codeplugcontext.cc:33
bool addRoamingZone(RoamingZone *zone, int index)
Associates the given roaming zone with the given index.
Definition: codeplugcontext.cc:234
QHash< int, int > _digitalContactTable
Maps a code-plug digital-contact index to the contact index within the wrapped radio config.
Definition: codeplugcontext.hh:103
bool hasRoamingChannel(int index) const
Returns true if a roaming channel is defined for the given index.
Definition: codeplugcontext.cc:246
Config * config() const
Returns the wrapped config.
Definition: codeplugcontext.cc:13
Channel * getChannel(int index) const
Gets a channel for the specified index or nullptr if not defined.
Definition: codeplugcontext.cc:69
bool addAPRSSystem(APRSSystem *sys, int index)
Adds an APRS system to the config and maps the given index to that APRS system.
Definition: codeplugcontext.cc:210
QHash< int, int > _channelTable
Maps a code-plug channel index to the channel index within the wrapped radio config.
Definition: codeplugcontext.hh:101
bool addChannel(Channel *ch, int index)
Adds a channel to the config and maps the given index to that channel.
Definition: codeplugcontext.cc:57
DMRRadioID * getRadioId(int idx) const
Maps the given index to the associated radio ID.
Definition: codeplugcontext.cc:44
bool hasGPSSystem(int index) const
Returns true, if the given GPS system index has been defined before.
Definition: codeplugcontext.cc:174
bool hasAnalogContact(int index) const
Returns true, if the given analog contact index has been defined before.
Definition: codeplugcontext.cc:102
bool hasRoamingZone(int index) const
Returns true if the given roaming zone index is defined.
Definition: codeplugcontext.cc:222
QHash< int, int > _groupListTable
Maps a code-plug RX group-list index to the group-list index within the wrapped radio config.
Definition: codeplugcontext.hh:107
bool addDigitalContact(DMRContact *con, int index)
Adds a digital contact to the config and maps the given index to that contact.
Definition: codeplugcontext.cc:82
bool hasAPRSSystem(int index) const
Returns true, if the given APRS system index has been defined before.
Definition: codeplugcontext.cc:198
bool addGPSSystem(GPSSystem *sys, int index)
Adds a GPS system to the config and maps the given index to that GPS system.
Definition: codeplugcontext.cc:186
bool hasChannel(int index) const
Returns true, if the given channel index has been defined before.
Definition: codeplugcontext.cc:52
CodeplugContext(Config *config)
Wraps the given device config.
Definition: codeplugcontext.cc:5
DMRContact * getDigitalContact(int index) const
Gets a digital contact for the specified index or nullptr if not defined.
Definition: codeplugcontext.cc:94
bool hasScanList(int index) const
Returns true, if the given scan list index has been defined before.
Definition: codeplugcontext.cc:150
QHash< int, int > _gpsSystemTable
Maps a code-plug GPS system index to the GPS system index within the wrapped radio config.
Definition: codeplugcontext.hh:111
DTMFContact * getAnalogContact(int index) const
Gets a analog contact for the specified index or nullptr if not defined.
Definition: codeplugcontext.cc:118
Config * _config
The wrapped radio config (aka abstract code-plug).
Definition: codeplugcontext.hh:97
bool addGroupList(RXGroupList *grp, int index)
Adds a RX group list to the config and maps the given index to that group list.
Definition: codeplugcontext.cc:131
bool addAnalogContact(DTMFContact *con, int index)
Adds a analog contact to the config and maps the given index to that contact.
Definition: codeplugcontext.cc:107
APRSSystem * getAPRSSystem(int index) const
Gets an APRS system for the specified index or nullptr if not defined.
Definition: codeplugcontext.cc:203
QHash< int, int > _roamingZoneTable
Maps a code-plug roaming zone index to the roaming zone index within the wrapped radio config.
Definition: codeplugcontext.hh:115
QHash< int, int > _aprsSystemTable
Maps a code-plug APRS system index to the APRS system index within the wrapped radio config.
Definition: codeplugcontext.hh:113
QHash< int, int > _radioIDTable
Maps a code-plug radio ID index to the radio ID index within the wrapped radio config.
Definition: codeplugcontext.hh:99
RXGroupList * getGroupList(int index) const
Gets a RX group list for the specified index or nullptr if not defined.
Definition: codeplugcontext.cc:142
QHash< int, int > _roamingChannelTable
Maps a code-plug roaming channel index to a digital channel index within the wrapped radio config.
Definition: codeplugcontext.hh:117
bool addRoamingChannel(DMRChannel *ch, int index)
Associates the given digital channel as the roaming channel with the given index.
Definition: codeplugcontext.cc:258
bool addScanList(ScanList *lst, int index)
Adds a scan list to the config and maps the given index to that scan list.
Definition: codeplugcontext.cc:162
bool hasRadioId(int index) const
Returns true if the radio DMR ID of given index is set.
Definition: codeplugcontext.cc:19
The config class, representing the codeplug configuration.
Definition: config.hh:67
Extension to the DigitalChannel class to implement an DMR channel.
Definition: channel.hh:345
Represents a digital contact, that is a DMR number.
Definition: contact.hh:140
Represents a DMR radio ID within the abstract config.
Definition: radioid.hh:32
Represents an analog contact, that is a DTMF number.
Definition: contact.hh:88
This class represents a GPS signalling system within the codeplug.
Definition: gpssystem.hh:62
Generic representation of a RX group list.
Definition: rxgrouplist.hh:15
Represents a RoamingZone within the abstract device configuration.
Definition: roaming.hh:15
Generic representation of a scan list.
Definition: scanlist.hh:15