diff --git a/Configuration.cpp b/Configuration.cpp
index 27a7aee..fb2e1b3 100644
--- a/Configuration.cpp
+++ b/Configuration.cpp
@@ -649,6 +649,7 @@ private:
bool clear_callsign_;
bool miles_;
bool hold_ptt_;
+ bool avoid_forced_identify_;
bool avoid_allcall_;
bool spellcheck_;
bool quick_call_;
@@ -791,6 +792,7 @@ bool Configuration::ppfx() const {return m_->ppfx_;}
bool Configuration::clear_callsign () const {return m_->clear_callsign_;}
bool Configuration::miles () const {return m_->miles_;}
bool Configuration::hold_ptt() const {return m_->hold_ptt_;}
+bool Configuration::avoid_forced_identify() const {return m_->avoid_forced_identify_;}
bool Configuration::avoid_allcall () const {return m_->avoid_allcall_;}
bool Configuration::set_avoid_allcall(bool avoid) {
if(m_->avoid_allcall_ != avoid){
@@ -1434,7 +1436,8 @@ void Configuration::impl::initialize_models ()
ui_->clear_callsign_check_box->setChecked (clear_callsign_);
ui_->miles_check_box->setChecked (miles_);
ui_->hold_ptt_check_box->setChecked(hold_ptt_);
- ui_->avoid_allcall_checkbox->setChecked(avoid_allcall_);
+ ui_->avoid_forced_identify_check_box->setChecked(avoid_forced_identify_);
+ ui_->avoid_allcall_check_box->setChecked(avoid_allcall_);
ui_->spellcheck_check_box->setChecked(spellcheck_);
ui_->quick_call_check_box->setChecked (quick_call_);
ui_->disable_TX_on_73_check_box->setChecked (disable_TX_on_73_);
@@ -1752,6 +1755,7 @@ void Configuration::impl::read_settings ()
clear_callsign_ = settings_->value ("ClearCallGrid", false).toBool ();
miles_ = settings_->value ("Miles", false).toBool ();
hold_ptt_ = settings_->value ("HoldPTT", false).toBool();
+ avoid_forced_identify_ = settings_->value ("AvoidForcedIdentify", false).toBool ();
avoid_allcall_ = settings_->value ("AvoidAllcall", false).toBool ();
spellcheck_ = settings_->value ("Spellcheck", true).toBool();
quick_call_ = settings_->value ("QuickCall", false).toBool ();
@@ -1895,6 +1899,7 @@ void Configuration::impl::write_settings ()
settings_->setValue ("ClearCallGrid", clear_callsign_);
settings_->setValue ("Miles", miles_);
settings_->setValue ("HoldPTT", hold_ptt_);
+ settings_->setValue ("AvoidForcedIdentify", avoid_forced_identify_);
settings_->setValue ("AvoidAllcall", avoid_allcall_);
settings_->setValue ("Spellcheck", spellcheck_);
settings_->setValue ("QuickCall", quick_call_);
@@ -2428,7 +2433,8 @@ void Configuration::impl::accept ()
clear_callsign_ = ui_->clear_callsign_check_box->isChecked ();
miles_ = ui_->miles_check_box->isChecked ();
hold_ptt_ = ui_->hold_ptt_check_box->isChecked();
- avoid_allcall_ = ui_->avoid_allcall_checkbox->isChecked();
+ avoid_forced_identify_ = ui_->avoid_forced_identify_check_box->isChecked();
+ avoid_allcall_ = ui_->avoid_allcall_check_box->isChecked();
spellcheck_ = ui_->spellcheck_check_box->isChecked();
quick_call_ = ui_->quick_call_check_box->isChecked ();
disable_TX_on_73_ = ui_->disable_TX_on_73_check_box->isChecked ();
diff --git a/Configuration.hpp b/Configuration.hpp
index 5b4ba8d..14d5b54 100644
--- a/Configuration.hpp
+++ b/Configuration.hpp
@@ -140,6 +140,7 @@ public:
bool clear_callsign () const;
bool miles () const;
bool hold_ptt() const;
+ bool avoid_forced_identify() const;
bool avoid_allcall () const;
bool set_avoid_allcall (bool avoid);
bool spellcheck() const;
diff --git a/Configuration.ui b/Configuration.ui
index 8fdc697..192aa9f 100644
--- a/Configuration.ui
+++ b/Configuration.ui
@@ -23,7 +23,7 @@
Select tab to change configuration parameters.
- 1
+ 0
@@ -146,7 +146,7 @@
-
-
+
Do not participate in the @ALLCALL group
@@ -278,8 +278,8 @@
0
0
- 615
- 750
+ 724
+ 779
@@ -387,6 +387,13 @@
+ -
+
+
+ Allow sending standard messages without callsign
+
+
+
-
@@ -1429,9 +1436,9 @@ a few, particularly some Kenwood rigs, require it).
0
- -102
+ 0
718
- 496
+ 490
@@ -4059,7 +4066,7 @@ soundcard changes
callsign_line_edit
grid_line_edit
groups_line_edit
- avoid_allcall_checkbox
+ avoid_allcall_check_box
cq_message_line_edit
reply_message_line_edit
info_message_line_edit
diff --git a/mainwindow.cpp b/mainwindow.cpp
index ae23e32..125c67f 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -6279,11 +6279,14 @@ QList> MainWindow::buildMessageFrames(const QString &text){
QString mycall = m_config.my_callsign();
QString mygrid = m_config.my_grid().left(4);
+ bool forceIdentify = !m_config.avoid_forced_identify();
+
auto frames = Varicode::buildMessageFrames(
mycall,
mygrid,
selectedCall,
- text);
+ text,
+ forceIdentify);
#if 0
qDebug() << "frames:";
@@ -9382,24 +9385,18 @@ void MainWindow::refreshTextDisplay(){
#else
// prepare selected callsign for directed message
QString selectedCall = callsignSelected();
- //qDebug() << "selected callsign for directed" << selectedCall;
// prepare compound
- //bool compound = Varicode::isCompoundCallsign(/*Radio::is_compound_callsign(*/m_config.my_callsign());
QString mycall = m_config.my_callsign();
QString mygrid = m_config.my_grid().left(4);
- //QString basecall = Radio::base_callsign(m_config.my_callsign());
- //if(basecall != mycall){
- // basecall = "<....>";
- //}
+ bool forceIdentify = !m_config.avoid_forced_identify();
BuildMessageFramesThread *t = new BuildMessageFramesThread(
mycall,
- //basecall,
mygrid,
- //compound,
selectedCall,
- text
+ text,
+ forceIdentify
);
connect(t, &BuildMessageFramesThread::finished, t, &QObject::deleteLater);
diff --git a/varicode.cpp b/varicode.cpp
index 86e0bf5..beb8ef4 100644
--- a/varicode.cpp
+++ b/varicode.cpp
@@ -1733,19 +1733,23 @@ QList> Varicode::buildMessageFrames(
QString const& mycall,
QString const& mygrid,
QString const& selectedCall,
- QString const& text
+ QString const& text,
+ bool forceIdentify
){
#define ALLOW_SEND_COMPOUND 1
#define ALLOW_SEND_COMPOUND_DIRECTED 1
#define AUTO_PREPEND_DIRECTED 1
#define AUTO_REMOVE_MYCALL 1
#define AUTO_PREPEND_DIRECTED_ALLOW_TEXT_CALLSIGNS 1
+ #define ALLOW_FORCE_IDENTIFY 1
bool mycallCompound = Varicode::isCompoundCallsign(mycall);
- QList> frames;
+ QList> allFrames;
foreach(QString line, text.split(QRegExp("[\\r\\n]"), QString::SkipEmptyParts)){
+ QList> lineFrames;
+
// once we find a directed call, data encode the rest of the line.
bool hasDirected = false;
@@ -1824,6 +1828,13 @@ QList> Varicode::buildMessageFrames(
qDebug() << "directed message to field is compound" << dirTo;
}
+#if ALLOW_FORCE_IDENTIFY
+ // if we're sending a data message, then ensure our callsign is included automatically
+ bool isLikelyDataFrame = lineFrames.isEmpty() && selectedCall.isEmpty() && dirTo.isEmpty() && l == 0 && o == 0;
+ if(forceIdentify && isLikelyDataFrame && !line.contains(mycall)){
+ line = QString("%1: %2").arg(mycall).arg(line);
+ }
+#endif
int m = 0;
QString datFrame = Varicode::packDataMessage(line, &m);
@@ -1857,13 +1868,13 @@ QList> Varicode::buildMessageFrames(
}
if(useBcn){
- frames.append({ frame, Varicode::JS8Call });
+ lineFrames.append({ frame, Varicode::JS8Call });
line = line.mid(l);
}
#if ALLOW_SEND_COMPOUND
if(useCmp){
- frames.append({ frame, Varicode::JS8Call });
+ lineFrames.append({ frame, Varicode::JS8Call });
line = line.mid(o);
}
#endif
@@ -1897,14 +1908,14 @@ QList> Varicode::buildMessageFrames(
QString deCompoundMessage = QString("`%1 %2").arg(mycall).arg(mygrid);
QString deCompoundFrame = Varicode::packCompoundMessage(deCompoundMessage, nullptr);
if(!deCompoundFrame.isEmpty()){
- frames.append({ deCompoundFrame, Varicode::JS8Call });
+ lineFrames.append({ deCompoundFrame, Varicode::JS8Call });
}
// Followed, by a standard OR compound directed message...
QString dirCompoundMessage = QString("`%1%2%3").arg(dirTo).arg(dirCmd).arg(dirNum);
QString dirCompoundFrame = Varicode::packCompoundMessage(dirCompoundMessage, nullptr);
if(!dirCompoundFrame.isEmpty()){
- frames.append({ dirCompoundFrame, Varicode::JS8Call });
+ lineFrames.append({ dirCompoundFrame, Varicode::JS8Call });
}
shouldUseStandardFrame = false;
}
@@ -1912,7 +1923,7 @@ QList> Varicode::buildMessageFrames(
if(shouldUseStandardFrame) {
// otherwise, just send the standard directed frame
- frames.append({ frame, Varicode::JS8Call });
+ lineFrames.append({ frame, Varicode::JS8Call });
}
line = line.mid(n);
@@ -1940,30 +1951,34 @@ QList> Varicode::buildMessageFrames(
}
if(useDat){
- frames.append({ frame, Varicode::JS8Call });
+ lineFrames.append({ frame, Varicode::JS8Call });
line = line.mid(m);
}
}
+
+ if(!lineFrames.isEmpty()){
+ lineFrames.first().second |= Varicode::JS8CallFirst;
+ lineFrames.last().second |= Varicode::JS8CallLast;
+ }
+
+ allFrames.append(lineFrames);
}
- if(!frames.isEmpty()){
- frames.first().second |= Varicode::JS8CallFirst;
- frames.last().second |= Varicode::JS8CallLast;
- }
-
- return frames;
+ return allFrames;
}
-BuildMessageFramesThread::BuildMessageFramesThread(
- const QString &mycall,
+BuildMessageFramesThread::BuildMessageFramesThread(const QString &mycall,
const QString &mygrid,
const QString &selectedCall,
- const QString &text, QObject *parent):
+ const QString &text,
+ bool forceIdentify,
+ QObject *parent):
QThread(parent),
m_mycall{mycall},
m_mygrid{mygrid},
m_selectedCall{selectedCall},
- m_text{text}
+ m_text{text},
+ m_forceIdentify{forceIdentify}
{
}
@@ -1972,7 +1987,8 @@ void BuildMessageFramesThread::run(){
m_mycall,
m_mygrid,
m_selectedCall,
- m_text
+ m_text,
+ m_forceIdentify
);
// TODO: jsherer - we wouldn't normally use decodedtext.h here... but it's useful for computing the actual frames transmitted.
diff --git a/varicode.h b/varicode.h
index 0fe6aa9..685db4a 100644
--- a/varicode.h
+++ b/varicode.h
@@ -156,12 +156,11 @@ public:
static QString packDataMessage(QString const& text, int *n);
static QString unpackDataMessage(QString const& text);
- static QList> buildMessageFrames(
- QString const& mycall,
+ static QList> buildMessageFrames(QString const& mycall,
QString const& mygrid,
QString const& selectedCall,
- QString const& text
- );
+ QString const& text,
+ bool forceIdentify);
};
@@ -173,6 +172,7 @@ public:
QString const& mygrid,
QString const& selectedCall,
QString const& text,
+ bool forceIdentify,
QObject *parent=nullptr);
void run() override;
signals:
@@ -183,6 +183,7 @@ private:
QString m_mygrid;
QString m_selectedCall;
QString m_text;
+ bool m_forceIdentify;
};
#endif // VARICODE_H