5#include <QAbstractTableModel>
7#include "configobject.hh"
8#include "configreference.hh"
13#include "channel_extension.hh"
14#include "opengd77_extension.hh"
15#include "tyt_extensions.hh"
16#include "opengd77_extension.hh"
17#include "anytone_extension.hh"
18#include "commercial_extension.hh"
61 Q_CLASSINFO(
"IdPrefix",
"ch")
83 None=0, DMR=1, M17=2, FM=4, AM=8, Analog=FM|AM, Digital=DMR|M17, All=Analog|Digital
86 Q_DECLARE_FLAGS(Types,
Type);
92 explicit Channel(QObject *parent=
nullptr);
296 Q_INVOKABLE
explicit FMChannel(QObject *parent=
nullptr);
374 Q_INVOKABLE
explicit AMChannel(QObject *parent=
nullptr);
378 void clear()
override;
456 Q_INVOKABLE
explicit DMRChannel(QObject *parent=
nullptr);
585 Voice, Data, VoiceAndData
591 None, AES256, Scrambled
709Q_DECLARE_OPERATORS_FOR_FLAGS(Channel::Types)
void clear() override
Clears the config object.
Definition channel.cc:591
bool copy(const ConfigItem &other) override
Copies the given item into this one.
Definition channel.cc:573
Q_INVOKABLE AMChannel(QObject *parent=nullptr)
Constructs a new empty AM channel.
Definition channel.cc:565
ConfigItem * clone() const override
Clones this item.
Definition channel.cc:581
bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack()) override
Parses the given YAML node, updates the given object and updates the given context (IDs).
Definition channel.cc:608
YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack()) override
Recursively serializes the configuration to YAML nodes.
Definition channel.cc:597
bool squelchDisabled() const
Returns true if the squelch is disabled.
Definition channel.cc:372
Level _squelch
Squelch.
Definition channel.hh:246
Level squelch
Specifies the squelch level for the channel.
Definition channel.hh:219
AnalogChannel(QObject *parent=nullptr)
Hidden constructor.
Definition channel.cc:353
void disableSquelch()
Disables the quelch.
Definition channel.cc:388
bool defaultSquelch() const
Returns true if the global default squelch level is used.
Definition channel.cc:368
void setSquelchDefault()
Sets the squelch to the global default value.
Definition channel.cc:392
bool setSquelch(Level squelch)
(Re-)Sets the squelch level [0,10].
Definition channel.cc:380
Implements the settings extension for DMR channels on AnyTone devices.
Definition anytone_extension.hh:204
Implements the settings extension for FM channels on AnyTone devices.
Definition anytone_extension.hh:133
ChannelList(QObject *parent=nullptr)
Constructs an empty channel list.
Definition channel.cc:1070
int add(ConfigObject *obj, int row=-1, bool unique=true)
Adds an element to the list.
Definition channel.cc:1077
ConfigItem * allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack())
Allocates a member objects for the given YAML node.
Definition channel.cc:1122
Channel * channel(int idx) const
Gets the channel at the specified index.
Definition channel.cc:1086
DMRChannel * findDMRChannel(Frequency rx, Frequency tx, DMRChannel::TimeSlot ts, unsigned cc) const
Finds a digital channel with the given frequencies, time slot and color code.
Definition channel.cc:1093
FMChannel * findFMChannelByTxFreq(Frequency freq) const
Finds an analog channel with the given frequency.
Definition channel.cc:1111
The base class of all channels (analog and digital) of a codeplug configuration.
Definition channel.hh:38
ScanList * scanList() const
Returns the default scan list for the channel.
Definition channel.cc:248
bool link(const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack())
Links the given object to the rest of the codeplug using the given context.
Definition channel.cc:336
void setDefaultTimeout()
Sets the timeout to the global default timeout.
Definition channel.cc:184
Interval timeout
The transmit timeout in seconds.
Definition channel.hh:48
FrequencyOffset offsetFrequency() const
Returns the offset between tx and rx frequency of the channel in Hz.
Definition channel.cc:112
bool defaultTimeout() const
Returns true if the transmit timeout is specified by the global default value.
Definition channel.cc:158
ScanListReference * scanListRef
The scan list.
Definition channel.hh:52
TyTChannelExtension * tyt
The TyT channel extension.
Definition channel.hh:58
bool _defaultPower
If true, the channel uses the global power setting.
Definition channel.hh:191
Frequency _txFreq
The TX frequency in Hz.
Definition channel.hh:189
void setPower(Power power)
(Re-)Sets the power setting of the channel, overrides default power.
Definition channel.cc:139
Power power
The transmit power.
Definition channel.hh:46
OffsetShift offsetShift() const
Returns direction of offset if any.
Definition channel.cc:118
Power
Specifies the prefix for every ID assigned to every channel during serialization.
Definition channel.hh:65
@ Low
Low power setting (e.g., 1W).
Definition channel.hh:69
@ Mid
Medium power setting (e.g., 2W, if available).
Definition channel.hh:68
@ High
High power setting (e.g, 5W).
Definition channel.hh:67
@ Max
Highest power setting (e.g. > 5W, if available).
Definition channel.hh:66
@ Min
Lowest power setting (e.g., <1W, if available).
Definition channel.hh:70
OffsetShift
Definition channel.hh:74
@ Positive
Positive offset between TX/RX frequencies.
Definition channel.hh:76
@ None
No Offset between TX/RX frequencies.
Definition channel.hh:75
@ Negative
Negative offset between TX/RX frequencies.
Definition channel.hh:77
TyTChannelExtension * tytChannelExtension() const
Returns the channel extension for TyT devices.
Definition channel.cc:279
void setTyTChannelExtension(TyTChannelExtension *ext)
Sets the TyT channel extension.
Definition channel.cc:283
void clear()
Clears the config object.
Definition channel.cc:63
bool voxDisabled() const
Returns true if the VOX is disabled.
Definition channel.cc:210
bool populate(YAML::Node &node, const Context &context, const ErrorStack &err=ErrorStack())
Recursively serializes the configuration to YAML nodes.
Definition channel.cc:296
TyTChannelExtension * _tytChannelExtension
Owns the TyT channel extension object.
Definition channel.hh:206
OpenGD77ChannelExtension * _openGD77ChannelExtension
Owns the OpenGD77 channel extension object.
Definition channel.hh:204
void setDefaultPower()
Sets the channel to use the default power setting.
Definition channel.cc:148
Interval _txTimeOut
Transmit timeout.
Definition channel.hh:196
bool copy(const ConfigItem &other)
Copies the given item into this one.
Definition channel.cc:47
void disableTimeout()
Disables the transmit timeout.
Definition channel.cc:193
bool _rxOnly
RX only flag.
Definition channel.hh:198
bool rxOnly
If true, the channel is receive only.
Definition channel.hh:50
bool timeoutDisabled() const
Returns true if the transmit timeout is disabled.
Definition channel.cc:163
void setVOX(Level level)
Sets the VOX level [0-10].
Definition channel.cc:222
Channel(QObject *parent=nullptr)
Hidden constructor.
Definition channel.cc:20
ScanListReference * scanListRef()
Returns the reference to the scan list.
bool setRXOnly(bool enable)
Set, whether the channel is RX only.
Definition channel.cc:203
bool defaultVOX() const
Returns true if the VOX is specified by the global default value.
Definition channel.cc:214
bool defaultPower() const
Returns true if the channel uses the global default power setting.
Definition channel.cc:129
Frequency rxFrequency
The receive frequency of the channel in Hz.
Definition channel.hh:42
OpenGD77ChannelExtension * openGD77ChannelExtension() const
Returns the channel extension for the OpenGD77 firmware.
Definition channel.cc:262
bool setTXFrequency(Frequency freq)
(Re-)Sets the TX frequency of the channel in Hz.
Definition channel.cc:101
Level vox
The VOX setting.
Definition channel.hh:54
bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack())
Parses the given YAML node, updates the given object and updates the given context (IDs).
Definition channel.cc:312
void disableVOX()
Disables the VOX.
Definition channel.cc:233
void onReferenceModified()
Gets called whenever a referenced object is changed or deleted.
Definition channel.cc:257
Frequency _rxFreq
The RX frequency in Hz.
Definition channel.hh:187
void setOpenGD77ChannelExtension(OpenGD77ChannelExtension *ext)
Sets the OpenGD77 channel extension.
Definition channel.cc:266
bool setScanList(ScanList *list)
(Re-) Sets the default scan list for the channel.
Definition channel.cc:252
bool setTimeout(const Interval &dur)
(Re-)Sets the TX timeout (TOT) in seconds.
Definition channel.cc:173
Level _vox
Holds the VOX level.
Definition channel.hh:200
bool setRXFrequency(Frequency freq)
(Re-)Sets the RX frequency of the channel in Hz.
Definition channel.cc:85
void setVOXDefault()
Sets the VOX level to the default value.
Definition channel.cc:229
ScanListReference _scanlist
Default scan list of the channel.
Definition channel.hh:202
OpenGD77ChannelExtension * openGD77
The OpenGD77 channel extension.
Definition channel.hh:56
Type
Options for type selection flags.
Definition channel.hh:82
Frequency txFrequency
The transmit frequency of the channel in Hz.
Definition channel.hh:44
Power _power
The transmit power setting.
Definition channel.hh:193
Implements the generic extension for all channels configuring commercial features of DMR.
Definition commercial_extension.hh:35
Parse context for config objects.
Definition configobject.hh:43
Base class for all configuration objects (channels, zones, contacts, etc).
Definition configobject.hh:35
ConfigItem(QObject *parent=nullptr)
Hidden constructor.
Definition configobject.cc:158
ConfigObjectList(const QMetaObject &elementTypes=ConfigItem::staticMetaObject, QObject *parent=nullptr)
Hidden constructor.
Definition configobject.cc:1511
Base class of all labeled and named objects.
Definition configobject.hh:192
ConfigObject(QObject *parent=nullptr)
Specifies the prefix for every ID assigned to every object during serialization.
Definition configobject.cc:1141
The config class, representing the codeplug configuration.
Definition config.hh:70
Common DMR channel extended settings.
Definition channel_extension.hh:64
Extension to the DigitalChannel class to implement an DMR channel.
Definition channel.hh:411
DMRChannelExtension * extended
The extended dmr channel settings.
Definition channel.hh:432
ConfigItem * clone() const
Clones this item.
Definition channel.cc:684
CommercialChannelExtension * commercial
The commercial channel extension.
Definition channel.hh:434
void setAnytoneChannelExtension(AnytoneDMRChannelExtension *ext)
Sets the AnyTone DMR channel extension.
Definition channel.cc:872
TimeSlot
Possible timeslots for digital channels.
Definition channel.hh:448
@ TS2
Time/repeater slot 2.
Definition channel.hh:450
@ TS1
Time/repeater slot 1.
Definition channel.hh:449
const GroupListReference * groupListRef() const
Returns a reference to the group list.
Definition channel.cc:730
void setAdmit(Admit admit)
(Re-)Sets the admit criterion for the channel.
Definition channel.cc:698
bool setTimeSlot(TimeSlot ts)
(Re-)Sets the time slot for the channel.
Definition channel.cc:723
const RoamingZoneReference * roamingRef() const
Returns a reference to the roamingRef zone.
Definition channel.cc:799
const DMRContactReference * contactRef() const
Returns a reference to the transmit contactRef.
Definition channel.cc:753
bool setRadioId(DMRRadioID *id)
Associates the given radio ID with this channel.
Definition channel.cc:836
bool setContact(DMRContact *c)
(Re-) Sets the default TX contact for this channel.
Definition channel.cc:768
TimeSlot timeSlot
The time slot of the channel.
Definition channel.hh:419
bool setColorCode(unsigned cc)
(Re-)Sets the color code for the channel.
Definition channel.cc:708
PositioningSystemReference * aprs
The positioning system.
Definition channel.hh:427
unsigned _colorCode
The channel color code.
Definition channel.hh:542
AnytoneDMRChannelExtension * _anytoneExtension
Owns the AnyTone DMR channel extension.
Definition channel.hh:561
Admit
Possible admit criteria of digital channels.
Definition channel.hh:440
@ Always
No admit criteria, allows one to transmit any time.
Definition channel.hh:441
@ Free
Transmit only if channel is free.
Definition channel.hh:442
@ ColorCode
Transmit if channel is free or differs given color code.
Definition channel.hh:443
void setCommercialExtension(CommercialChannelExtension *ext)
Sets the commercial channel extension.
Definition channel.cc:855
AnytoneDMRChannelExtension * anytoneChannelExtension() const
Returns the DMR channel extension for AnyTone devices.
Definition channel.cc:868
DMRRadioIDReference _radioId
Radio ID to use on this channel.
Definition channel.hh:554
Admit _admit
The admit criterion.
Definition channel.hh:540
const DMRRadioIDReference * radioIdRef() const
Returns the reference to the radio ID.
Definition channel.cc:821
PositioningSystemReference _posSystem
The GPS system.
Definition channel.hh:550
DMRChannelExtension * _extended
Owns the extended channel extension.
Definition channel.hh:557
GroupListReference * groupList
The rx group list.
Definition channel.hh:423
RoamingZoneReference * roaming
The roaming zone.
Definition channel.hh:429
DMRContactReference * contact
The tx contact.
Definition channel.hh:425
unsigned colorCode
The color code of the channel.
Definition channel.hh:417
CommercialChannelExtension * commercialExtension() const
Returns the extension for commercial features.
Definition channel.cc:851
void clear()
Clears the config object.
Definition channel.cc:670
Admit admit
The admit criterion of the channel.
Definition channel.hh:415
TimeSlot _timeSlot
The time slot for the channel.
Definition channel.hh:544
GroupListReference _rxGroup
The RX group list for this channel.
Definition channel.hh:546
bool setAPRS(PositionReportingSystem *sys)
Associates the GPS System with this channel.
Definition channel.cc:791
bool setRoaming(RoamingZone *zone)
Associates the given roaming zone with this channel.
Definition channel.cc:814
CommercialChannelExtension * _commercialExtension
Owns the commercial channel extension.
Definition channel.hh:559
const PositioningSystemReference * aprsRef() const
Returns a reference to the positioning system.
Definition channel.cc:776
DMRContactReference _txContact
The default TX contact.
Definition channel.hh:548
Q_INVOKABLE DMRChannel(QObject *parent=nullptr)
Constructs a new empty digital (DMR) channel.
Definition channel.cc:644
RoamingZoneReference _roaming
Roaming zone for the channel.
Definition channel.hh:552
bool setGroupList(RXGroupList *rxg)
(Re-)Sets the RX group list for the channel.
Definition channel.cc:745
DMRRadioIDReference * radioId
The radio ID.
Definition channel.hh:421
AnytoneDMRChannelExtension * anytone
The AnyTone DMR channel extension.
Definition channel.hh:436
YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack())
Recursively serializes the configuration to YAML nodes.
Definition channel.cc:885
Implements a reference to a radio ID.
Definition configreference.hh:263
Represents a DMR radio ID within the abstract config.
Definition radioid.hh:33
DigitalChannel(QObject *parent=nullptr)
Hidden constructor.
Definition channel.cc:628
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:43
Common FM channel extended settings.
Definition channel_extension.hh:37
Extension to the AnalogChannel class to implement an analog FM channel.
Definition channel.hh:258
FMChannelExtension * _extended
Owns the extended settings.
Definition channel.hh:355
Bandwidth bandwidth
The band width of the channel.
Definition channel.hh:268
AnytoneFMChannelExtension * anytoneChannelExtension() const
Returns the FM channel extension for AnyTone devices.
Definition channel.cc:517
AnytoneFMChannelExtension * anytone
The AnyTone FM channel extension.
Definition channel.hh:275
bool setBandwidth(Bandwidth bw)
(Re-)Sets the bandwidth of the analog channel.
Definition channel.cc:484
SelectiveCall txTone
The TX tone (CTCSS/DSC).
Definition channel.hh:266
Admit _admit
Holds the admit criterion.
Definition channel.hh:345
Admit admit
The admit criterion of the channel.
Definition channel.hh:262
SelectiveCall rxTone
The RX tone (CTCSS/DSC).
Definition channel.hh:264
Bandwidth _bw
The channel bandwidth.
Definition channel.hh:351
bool copy(const ConfigItem &other)
Copies the given item into this one.
Definition channel.cc:414
Admit
Admit criteria of analog channel.
Definition channel.hh:280
@ Always
Allow always.
Definition channel.hh:281
@ Free
Allow when channel free.
Definition channel.hh:282
@ Tone
Allow when free or wrong ctcss/dcs tone is present.
Definition channel.hh:283
void setAdmit(Admit admit)
(Re-)Sets the admit criterion for the analog channel.
Definition channel.cc:452
ConfigItem * clone() const
Clones this item.
Definition channel.cc:426
SelectiveCall _rxTone
The RX CTCSS/DCS setting.
Definition channel.hh:347
const FMAPRSSystemReference * aprsRef() const
Returns the reference to the APRS system.
Definition channel.cc:491
Q_INVOKABLE FMChannel(QObject *parent=nullptr)
Constructs a new empty analog channel.
Definition channel.cc:402
bool setTXTone(SelectiveCall code)
(Re-)Sets the CTCSS/DCS TX tone, SIGNALING_NONE disables the TX tone.
Definition channel.cc:473
bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack())
Parses the given YAML node, updates the given object and updates the given context (IDs).
Definition channel.cc:545
SelectiveCall _txTone
The TX CTCSS/DCS setting.
Definition channel.hh:349
YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack())
Recursively serializes the configuration to YAML nodes.
Definition channel.cc:534
void setAPRS(FMAPRSSystem *sys)
Sets the APRS system.
Definition channel.cc:505
AnytoneFMChannelExtension * _anytoneExtension
Owns the AnyTone FM channel extension.
Definition channel.hh:357
Bandwidth
Possible bandwidth of an analog channel.
Definition channel.hh:288
@ Narrow
Narrow bandwidth (12.5kHz).
Definition channel.hh:289
@ Wide
Wide bandwidth (25kHz).
Definition channel.hh:290
bool setRXTone(SelectiveCall code)
(Re-)Sets the CTCSS/DCS RX tone, SIGNALING_NONE disables the RX tone.
Definition channel.cc:462
FMChannelExtension * extended
Common extended channel settings.
Definition channel.hh:273
void clear()
Clears the config object.
Definition channel.cc:436
FMAPRSSystemReference _aprsSystem
A reference to the APRS system used on the channel or nullptr if disabled.
Definition channel.hh:353
void setAnytoneChannelExtension(AnytoneFMChannelExtension *ext)
Sets the AnyTone FM channel extension.
Definition channel.cc:521
FMAPRSSystemReference * aprs
The APRS system.
Definition channel.hh:270
Implements a reference to a group list.
Definition configreference.hh:274
Represents a time interval.
Definition interval.hh:11
Some simple class implementing a [1-10] level setting.
Definition level.hh:15
Implements an M17 channel.
Definition channel.hh:568
bool setContact(M17Contact *c)
(Re-) Sets the default TX contact for this channel.
Definition channel.cc:989
M17ContactReference * contact
The transmit contact.
Definition channel.hh:574
void setEncryptionMode(EncryptionMode mode)
Sets the encryption mode of the channel.
Definition channel.cc:1015
Mode _mode
Holds the channel mode.
Definition channel.hh:640
const M17ContactReference * contactRef() const
Returns a reference to the transmit contact.
Definition channel.cc:966
void clear()
Clears the config object.
Definition channel.cc:919
unsigned int _accessNumber
Holds the channel access number.
Definition channel.hh:642
void setMode(Mode mode)
Sets the channel mode.
Definition channel.cc:944
M17ContactReference _txContact
The default TX contact.
Definition channel.hh:644
unsigned accessNumber
The channel access number.
Definition channel.hh:572
ConfigItem * clone() const
Clones this item.
Definition channel.cc:929
Mode mode
The channel mode.
Definition channel.hh:576
bool aprs
If enabled, positioning data is send along with voice and data.
Definition channel.hh:580
EncryptionMode _encryptionMode
Holds the encryption mode for the channel.
Definition channel.hh:648
void setContactRef(M17ContactReference *ref)
Sets the reference to the transmit contact.
Definition channel.cc:976
void enableAPRS(bool enabled)
Enables/disables APRS.
Definition channel.cc:1002
M17Channel(QObject *parent=nullptr)
Constructs a new empty M17 channel.
Definition channel.cc:899
bool _gpsEnabled
If true, positioning information is send alonside voice and data.
Definition channel.hh:646
bool aprsEnabled() const
Returns true if APRS is enabled.
Definition channel.cc:997
EncryptionMode encryptionMode
The encryption mode.
Definition channel.hh:578
EncryptionMode
Possible encryption modes.
Definition channel.hh:590
void setAccessNumber(unsigned int can)
Sets the channel access number (0-15).
Definition channel.cc:957
YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack())
Recursively serializes the configuration to YAML nodes.
Definition channel.cc:1023
Mode
Possible channel modes.
Definition channel.hh:584
Implements the channel extensions for the OpenGD77 radios.
Definition opengd77_extension.hh:18
Base class of the position reporting systems, that is APRS and DMR position reporting system.
Definition gpssystem.hh:17
Implements a reference to a positioning system.
Definition configreference.hh:226
Generic representation of a RX group list.
Definition rxgrouplist.hh:14
Implements a reference to a roaming zone.
Definition configreference.hh:285
Represents a RoamingZone within the abstract device configuration.
Definition roamingzone.hh:15
Implements a reference to a scan list.
Definition configreference.hh:215
Generic representation of a scan list.
Definition scanlist.hh:15
static SelectedChannel * _instance
Holds the channel singleton instance.
Definition channel.hh:675
virtual ~SelectedChannel()
Destructor.
Definition channel.cc:1045
ConfigItem * clone() const
Clones this item.
Definition channel.cc:1055
bool copy(const ConfigItem &other)
Copies the given item into this one.
Definition channel.cc:1050
static SelectedChannel * get()
Constructs/gets the singleton instance.
Definition channel.cc:1060
SelectedChannel()
Constructs the "selected" channel.
Definition channel.cc:1039
Represents the TyT channel extension.
Definition tyt_extensions.hh:15
Helper type to represent frequency differences aka offsets.
Definition frequency.hh:69
Helper type to encode frequencies without any rounding error.
Definition frequency.hh:107
Encodes a selective call.
Definition signaling.hh:13