Skip to content

Commit

Permalink
Started AnyTone channel extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmatuschek committed Mar 26, 2022
1 parent 740ff39 commit 8ccf2ce
Show file tree
Hide file tree
Showing 2 changed files with 225 additions and 0 deletions.
122 changes: 122 additions & 0 deletions lib/anytone_extension.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,127 @@
#include "anytone_extension.hh"


/* ********************************************************************************************* *
* Implementation of AnytoneChannelExtension
* ********************************************************************************************* */
AnytoneChannelExtension::AnytoneChannelExtension(QObject *parent)
: ConfigExtension(parent), _talkaround(false)
{
// pass...
}

bool
AnytoneChannelExtension::talkaround() const {
return _talkaround;
}
void
AnytoneChannelExtension::enableTalkaround(bool enable) {
if (enable == _talkaround)
return;
_talkaround = enable;
emit modified(this);
}


/* ********************************************************************************************* *
* Implementation of AnytoneAnalogChannelExtension
* ********************************************************************************************* */
AnytoneAnalogChannelExtension::AnytoneAnalogChannelExtension(QObject *parent)
: AnytoneChannelExtension(parent), _reverseBurst(false), _rxCustomCTCSS(false),
_txCustomCTCSS(false), _customCTCSS(0)
{
// pass...
}

ConfigItem *
AnytoneAnalogChannelExtension::clone() const {
AnytoneAnalogChannelExtension *ext = new AnytoneAnalogChannelExtension();
if (! ext->copy(*this)) {
ext->deleteLater();
return nullptr;
}
return ext;
}

bool
AnytoneAnalogChannelExtension::reverseBurst() const {
return _reverseBurst;
}
void
AnytoneAnalogChannelExtension::enableReverseBurst(bool enable) {
if (enable == _reverseBurst)
return;
_reverseBurst = enable;
emit modified(this);
}

bool
AnytoneAnalogChannelExtension::rxCustomCTCSS() const {
return _rxCustomCTCSS;
}
void
AnytoneAnalogChannelExtension::enableRXCustomCTCSS(bool enable) {
if (enable == _rxCustomCTCSS)
return;
_rxCustomCTCSS = enable;
emit modified(this);
}
bool
AnytoneAnalogChannelExtension::txCustomCTCSS() const {
return _txCustomCTCSS;
}
void
AnytoneAnalogChannelExtension::enableTXCustomCTCSS(bool enable) {
if (enable == _txCustomCTCSS)
return;
_txCustomCTCSS = enable;
emit modified(this);
}
double
AnytoneAnalogChannelExtension::customCTCSS() const {
return _customCTCSS;
}
void
AnytoneAnalogChannelExtension::setCustomCTCSS(double freq) {
if (freq == _customCTCSS)
return;
_customCTCSS = freq;
emit modified(this);
}


/* ********************************************************************************************* *
* Implementation of AnytoneDigitalChannelExtension
* ********************************************************************************************* */
AnytoneDigitalChannelExtension::AnytoneDigitalChannelExtension(QObject *parent)
: AnytoneChannelExtension(parent), _callConfirm(false)
{
// pass...
}

ConfigItem *
AnytoneDigitalChannelExtension::clone() const {
AnytoneDigitalChannelExtension *ext = new AnytoneDigitalChannelExtension();
if (! ext->copy(*this)) {
ext->deleteLater();
return nullptr;
}
return ext;
}

bool
AnytoneDigitalChannelExtension::callConfirm() const {
return _callConfirm;
}
void
AnytoneDigitalChannelExtension::enableCallConfirm(bool enabled) {
if (enabled == _callConfirm)
return;
_callConfirm = enabled;
emit modified(this);
}


/* ********************************************************************************************* *
* Implementation of AnytoneZoneExtension
* ********************************************************************************************* */
Expand Down
103 changes: 103 additions & 0 deletions lib/anytone_extension.hh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,109 @@

#include "configobject.hh"


/** Implements the common properties for analog and digital AnyTone channels.
* This class cannot be instantiated directly, use one of the derived classes.
* @ingroup anytone */
class AnytoneChannelExtension: public ConfigExtension
{
Q_OBJECT

/** If @c true, talkaround is enabled. */
Q_PROPERTY(bool talkaround READ talkaround WRITE enableTalkaround)

protected:
/** Hidden constructor. */
explicit AnytoneChannelExtension(QObject *parent=nullptr);

/** Returns @c true, if talkaround is enabled. */
bool talkaround() const;
/** Enables/disables talkaround. */
void enableTalkaround(bool enable);

protected:
/** If @c true, talkaround is enabled. */
bool _talkaround;
};


/** Implements the settings extension for FM channels on AnyTone devices.
* @ingroup anytone */
class AnytoneAnalogChannelExtension: public AnytoneChannelExtension
{
Q_OBJECT

/** If @c true, the CTCSS phase-reverse burst at the end of transmission is enabled. */
Q_PROPERTY(bool reverseBurst READ reverseBurst WRITE enableReverseBurst)
/** If @c true, the custom CTCSS tone is used for RX (open squelch). */
Q_PROPERTY(bool rxCustomCTCSS READ rxCustomCTCSS WRITE enableRXCustomCTCSS)
/** If @c true, the custom CTCSS tone is transmitted. */
Q_PROPERTY(bool txCustomCTCSS READ txCustomCTCSS WRITE enableTXCustomCTCSS)
/** Holds the custom CTCSS tone frequency in Hz. Resolution is 0.1Hz */
Q_PROPERTY(double customCTCSS READ customCTCSS WRITE setCustomCTCSS)

public:
/** Default constructor. */
Q_INVOKABLE explicit AnytoneAnalogChannelExtension(QObject *parent=nullptr);

ConfigItem *clone() const;

/** Returns @c true, if the CTCSS phase-reverse burst is enabled. */
bool reverseBurst() const;
/** Enables/disables the CTCSS phase-reverse burst. */
void enableReverseBurst(bool enable);

/** Returns @c true, if the custom CTCSS frequency is used for RX (open squelch). */
bool rxCustomCTCSS() const;
/** Enables/disables usage of custom CTCSS frequeny for RX. */
void enableRXCustomCTCSS(bool enable);
/** Returns @c true, if the custom CTCSS frequency is used for TX (open squelch). */
bool txCustomCTCSS() const;
/** Enables/disables usage of custom CTCSS frequeny for TX. */
void enableTXCustomCTCSS(bool enable);
/** Returns the custom CTCSS frequency in Hz. Resolution is 0.1Hz. */
double customCTCSS() const;
/** Sets the custom CTCSS frequency in Hz. Resolution is 0.1Hz. */
void setCustomCTCSS(double freq);

protected:
/** If @c true, the CTCSS phase-reverse burst at the end of transmission is enabled. */
bool _reverseBurst;
/** If @c true, the custom CTCSS tone is used for RX (open squelch). */
bool _rxCustomCTCSS;
/** If @c true, the custom CTCSS tone is transmitted. */
bool _txCustomCTCSS;
/** Holds the custom CTCSS tone frequency in Hz. Resolution is 0.1Hz */
double _customCTCSS;
};


/** Implements the settings extension for DMR channels on AnyTone devices.
* @ingroup anytone */
class AnytoneDigitalChannelExtension: public AnytoneChannelExtension
{
Q_OBJECT

/** If @c true, the call confirmation is enabled. */
Q_PROPERTY(bool callConfirm READ callConfirm WRITE enableCallConfirm)

public:
/** Default constructor. */
Q_INVOKABLE explicit AnytoneDigitalChannelExtension(QObject *parent=nullptr);

ConfigItem *clone() const;

/** Returns @c true if the call confirmation is enabled. */
bool callConfirm() const;
/** Enables/disables the call confrimation. */
void enableCallConfirm(bool enabled);

protected:
/** If @c true, the call confirmation is enabled. */
bool _callConfirm;
};


/** Implements the AnyTone extensions for zones.
* @ingroup anytone */
class AnytoneZoneExtension : public ConfigExtension
Expand Down

0 comments on commit 8ccf2ce

Please sign in to comment.