libdrmconf  0.11.3
A library to program DMR radios.
roamingchannel.hh
1 #ifndef ROAMINGCHANNEL_HH
2 #define ROAMINGCHANNEL_HH
3 
4 #include "channel.hh"
5 
16 {
17  Q_OBJECT
18  Q_CLASSINFO("IdPrefix", "rch")
19 
20 
21  Q_PROPERTY(double rxFrequency READ rxFrequency WRITE setRXFrequency)
23  Q_PROPERTY(double txFrequency READ txFrequency WRITE setTXFrequency)
25  Q_PROPERTY(bool overrideColorCode READ colorCodeOverridden WRITE overrideColorCode SCRIPTABLE false)
27  Q_PROPERTY(unsigned int colorCode READ colorCode WRITE setColorCode SCRIPTABLE false)
29  Q_PROPERTY(bool overrideTimeSlot READ timeSlotOverridden WRITE overrideTimeSlot SCRIPTABLE false)
31  Q_PROPERTY(DMRChannel::TimeSlot timeSlot READ timeSlot WRITE setTimeSlot SCRIPTABLE false)
32 
33 public:
35  explicit RoamingChannel(QObject *parent = nullptr);
37  RoamingChannel(const RoamingChannel &other, QObject *parent=nullptr);
38 
39  ConfigItem *clone() const;
40  void clear();
41 
43  double rxFrequency() const;
45  void setRXFrequency(double f);
47  double txFrequency() const;
49  void setTXFrequency(double f);
50 
52  bool colorCodeOverridden() const;
54  void overrideColorCode(bool override);
56  unsigned int colorCode() const;
58  void setColorCode(unsigned int cc);
59 
61  bool timeSlotOverridden() const;
63  void overrideTimeSlot(bool override);
68 
69  bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err);
70 
71 public:
74  static RoamingChannel *fromDMRChannel(DMRChannel *ch, DMRChannel *ref=nullptr);
75 
76 protected:
77  bool populate(YAML::Node &node, const Context &context, const ErrorStack &err);
78 
79 protected:
81  double _rxFrequency;
83  double _txFrequency;
87  unsigned int _colorCode;
92 };
93 
94 
99 {
100  Q_OBJECT
101 
102 public:
104  explicit RoamingChannelList(QObject *parent=nullptr);
105 
107  RoamingChannel *channel(int idx) const;
108 
109  int add(ConfigObject *obj, int row=-1);
110 
111 public:
112  ConfigItem *allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack());
113 };
114 
115 #endif // ROAMINGCHANNEL_HH
Parse context for config objects.
Definition: configobject.hh:48
Base class for all configuration objects (channels, zones, contacts, etc).
Definition: configobject.hh:40
List class for config objects.
Definition: configobject.hh:341
Base class of all labeled and named objects.
Definition: configobject.hh:199
Extension to the DigitalChannel class to implement an DMR channel.
Definition: channel.hh:350
TimeSlot
Possible timeslots for digital channels.
Definition: channel.hh:385
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Represents the list of roaming channels within the abstract device configuration.
Definition: roamingchannel.hh:99
int add(ConfigObject *obj, int row=-1)
Adds an element to the list.
Definition: roamingchannel.cc:211
RoamingChannel * channel(int idx) const
Returns the roaming channel at the given index.
Definition: roamingchannel.cc:204
RoamingChannelList(QObject *parent=nullptr)
Constructor.
Definition: roamingchannel.cc:197
ConfigItem * allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack())
Allocates a member objects for the given YAML node.
Definition: roamingchannel.cc:218
Represents a roaming channel.
Definition: roamingchannel.hh:16
void setRXFrequency(double f)
Sets the RX frquency in MHz.
Definition: roamingchannel.cc:42
bool _overrideColorCode
If true, the color code of the channel gets overridden by the one specified in _colorCode.
Definition: roamingchannel.hh:85
bool timeSlotOverridden() const
Returns true, if the time slot of the channel gets overridden.
Definition: roamingchannel.cc:86
DMRChannel::TimeSlot timeSlot
If overrideTimeSlot is true, specifies the time slot.
Definition: roamingchannel.hh:31
unsigned int _colorCode
If _overrideColorCode is true, specifies the color code.
Definition: roamingchannel.hh:87
bool _overrideTimeSlot
If true, the time slot of the channel gets overridden by the one specified in _timeSlot.
Definition: roamingchannel.hh:89
void setColorCode(unsigned int cc)
Sets the color code.
Definition: roamingchannel.cc:77
double _txFrequency
Holds the TX frequency in MHz.
Definition: roamingchannel.hh:83
double rxFrequency
Holds the RX frequency in MHz.
Definition: roamingchannel.hh:21
double txFrequency
Holds the TX frequency in MHz.
Definition: roamingchannel.hh:23
void clear()
Clears the config object.
Definition: roamingchannel.cc:20
bool overrideTimeSlot
If true, the time slot of the channel gets overridden by the one specified in timeSlot.
Definition: roamingchannel.hh:29
ConfigItem * clone() const
Clones this item.
Definition: roamingchannel.cc:28
static RoamingChannel * fromDMRChannel(DMRChannel *ch, DMRChannel *ref=nullptr)
Helper method to construct a Roaming channel from a given DMR channel.
Definition: roamingchannel.cc:109
bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err)
Parses the given YAML node, updates the given object and updates the given context (IDs).
Definition: roamingchannel.cc:128
double _rxFrequency
Holds the RX frequency in MHz.
Definition: roamingchannel.hh:81
bool populate(YAML::Node &node, const Context &context, const ErrorStack &err)
Recursively serializes the configuration to YAML nodes.
Definition: roamingchannel.cc:176
bool overrideColorCode
If true, the color code of the channel gets overridden by the one specified in colorCode.
Definition: roamingchannel.hh:25
void setTXFrequency(double f)
Sets the TX frquency in MHz.
Definition: roamingchannel.cc:54
unsigned int colorCode
If overrideColorCode is true, specifies the color code.
Definition: roamingchannel.hh:27
RoamingChannel(QObject *parent=nullptr)
Default constructor for a roaming channel.
Definition: roamingchannel.cc:6
void setTimeSlot(DMRChannel::TimeSlot ts)
Sets the time slot.
Definition: roamingchannel.cc:101
bool colorCodeOverridden() const
Returns true, if the color code of the channel gets overridden.
Definition: roamingchannel.cc:62
DMRChannel::TimeSlot _timeSlot
If _overrideTimeSlot is true, specifies the time slot.
Definition: roamingchannel.hh:91