show freq of regular fox verification msg

This commit is contained in:
Brian Moran 2024-09-03 13:09:36 -07:00
parent fe833b26ce
commit 91661c1d95
5 changed files with 11492 additions and 21 deletions

View File

@ -1,7 +1,7 @@
#include "FoxVerifier.hpp"
#include "Logger.hpp"
FoxVerifier::FoxVerifier(QString user_agent, QNetworkAccessManager *manager,QString base_url, QString callsign, QDateTime timestamp, QString code) : QObject(nullptr)
FoxVerifier::FoxVerifier(QString user_agent, QNetworkAccessManager *manager,QString base_url, QString callsign, QDateTime timestamp, QString code, unsigned int hz=750) : QObject(nullptr)
{
manager_ = manager;
finished_ = false;
@ -9,6 +9,7 @@ FoxVerifier::FoxVerifier(QString user_agent, QNetworkAccessManager *manager,QStr
callsign_ = callsign;
code_ = code;
ts_ = timestamp;
hz_ = hz;
QString url = QString("%1/check/%2/%3/%4.text").arg(base_url).arg(callsign).arg(timestamp.toString(Qt::ISODate)).arg(code);
LOG_INFO(QString("FoxVerifier: url %1").arg(url).toStdString());
@ -72,14 +73,14 @@ void FoxVerifier::httpFinished()
if (reply_->error() != QNetworkReply::NoError) {
LOG_INFO(QString("FoxVerifier: httpFinished error:[%1 - %2] msg:[%3]").arg(status).arg(reason).arg(reply_->errorString()).toStdString());
reply_->abort();
emit verifyError(status, ts_, callsign_, code_, reply_->errorString());
emit verifyError(status, ts_, callsign_, code_, hz_, reply_->errorString());
}
return_value = reply_->read(1024); // limit amount we get
LOG_INFO(QString("FoxVerifier: httpFinished status:[%1 - %2] body:[%3] ").arg(status).arg(reason).arg(return_value).toStdString());
finished_ = true;
reply_->deleteLater();
if (status >= 200 && status <= 299) {
emit verifyComplete(status, ts_, callsign_, code_, return_value);
emit verifyComplete(status, ts_, callsign_, code_, hz_, return_value);
}
}
@ -97,15 +98,16 @@ void FoxVerifier::httpEncrypted() {
LOG_INFO("FoxVerifier: httpEncrypted");
}
QString FoxVerifier::formatDecodeMessage(QDateTime ts, QString callsign, QString const& verify_message) {
QString FoxVerifier::formatDecodeMessage(QDateTime ts, QString callsign, unsigned int hz_, QString const& verify_message) {
//"172100 -00 0.0 750 ~ K8R VERIFIED"
QTime rx_time = ts.time();
QString hz=QString("%1").arg(hz_, 4, 10 ); // insert Hz
if (verify_message.endsWith(" VERIFIED")) {
return QString("%1 -00 0.0 750 ~ %2 VERIFIED").arg(rx_time.toString("hhmmss")).arg(callsign);
return QString("%1 0 0.0 %2 ~ %3 VERIFIED").arg(rx_time.toString("hhmmss")).arg(hz).arg(callsign);
} else
if (verify_message.endsWith(" INVALID"))
{
return QString("%1 0 0.0 750 ~ %2 INVALID").arg(rx_time.toString("hhmmss")).arg(callsign);
return QString("%1 0 0.0 %2 ~ %3 INVALID").arg(rx_time.toString("hhmmss")).arg(hz).arg(callsign);
}
else
return QString{};

View File

@ -16,12 +16,12 @@ class FoxVerifier : public QObject {
QMutex mutex_;
public:
explicit FoxVerifier(QString user_agent, QNetworkAccessManager *manager, QString base_url, QString callsign, QDateTime timestamp, QString code);
explicit FoxVerifier(QString user_agent, QNetworkAccessManager *manager, QString base_url, QString callsign, QDateTime timestamp, QString code, unsigned int);
~FoxVerifier();
QString return_value;
bool finished();
static QString formatDecodeMessage(QDateTime ts, QString callsign, QString const& verify_message);
static QString formatDecodeMessage(QDateTime ts, QString callsign, unsigned int hz, QString const& verify_message);
static QString default_url();
private:
@ -31,6 +31,7 @@ private:
QUrl q_url_;
bool finished_;
bool errored_;
unsigned int hz_;
QString error_reason_;
QDateTime ts_;
QString callsign_;
@ -54,8 +55,8 @@ private slots:
public slots:
signals:
void verifyComplete(int status, QDateTime ts, QString callsign, QString code, QString const& response);
void verifyError(int status, QDateTime ts, QString callsign, QString code, QString const& response);
void verifyComplete(int status, QDateTime ts, QString callsign, QString code, unsigned int hz, QString const& response);
void verifyError(int status, QDateTime ts, QString callsign, QString code, unsigned int hz, QString const& response);
};

View File

@ -2494,11 +2494,10 @@ void MainWindow::keyPressEvent (QKeyEvent * e)
QMainWindow::keyPressEvent (e);
}
void MainWindow::handleVerifyMsg(int status, QDateTime ts, QString callsign, QString code, QString const &response) {
(void)status;
void MainWindow::handleVerifyMsg(int status, QDateTime ts, QString callsign, QString code, unsigned int hz, QString const &response) { (void)status;
(void)code;
if (response.length() > 0) {
QString msg = FoxVerifier::formatDecodeMessage(ts, callsign, response);
QString msg = FoxVerifier::formatDecodeMessage(ts, callsign, hz, response);
if (msg.length() > 0)
ui->decodedTextBrowser->displayDecodedText(DecodedText{msg}, m_config.my_callsign(), m_mode, m_config.DXCC(),
m_logBook, m_currentBand, m_config.ppfx());
@ -4293,6 +4292,7 @@ void MainWindow::readFromStdout() //readFromStdout
}
} else {
#ifdef FOX_OTP
// remove verifications that are done
QMutableListIterator < FoxVerifier * > it(m_verifications);
while (it.hasNext()) {
@ -4300,34 +4300,38 @@ void MainWindow::readFromStdout() //readFromStdout
it.remove();
}
}
#endif
DecodedText decodedtext1 = decodedtext0;
if ((m_mode == "FT4" or m_mode == "FT8") and bDisplayPoints and decodedtext1.isStandardMessage()) {
ARRL_Digi_Update(decodedtext1);
}
#ifdef FOX_OTP
if ((SpecOp::HOUND == m_specOp) &&
((m_config.superFox() && (decodedtext0.mid(24, 8) == "$VERIFY$")) || // $VERIFY$ K8R 920749
(decodedtext0.mid(24, 8).contains(QRegularExpression{"^[A-Z0-9]{2,5}\\.V[0-9]{6}$"})))) // K8R.V920749
(decodedtext0.mid(24,-1).contains(QRegularExpression{"^[A-Z0-9]{2,5}\\.V[0-9]{6}"})))) // K8R.V920749
{
// two cases:
// QString test_return = QString{"203630 -12 0.1 775 ~ K8R.V920749"};
// $VERIFY$ foxcall otp
// QString test_return = QString{"203630 -12 0.1 775 ~ $VERIFY$ K8R 920749"};
QStringList lineparts;
QStringList otp_parts;
QString callsign, otp;
unsigned int hz;
lineparts = decodedtext0.string().split(' ', SkipEmptyParts);
if (lineparts.length() <= 6) {
QStringList otp_parts;
// split K8R.V920749 into K8R and 920749
otp_parts = lineparts[5].split('.', SkipEmptyParts);
callsign = otp_parts[0];
otp = otp_parts[1].mid(1); // remove the V
hz = lineparts[3].toInt();
} else
{
// split $VERIFY$ K8R 920749 into K8R and 920749
callsign = lineparts[6];
otp = lineparts[7];
hz = 750; // SF is 750
}
QDateTime verifyDateTime;
if (m_diskData) {
@ -4341,11 +4345,13 @@ void MainWindow::readFromStdout() //readFromStdout
FOXVERIFIER_DEFAULT_BASE_URL,
callsign, // foxcall
verifyDateTime,
otp); // otp
otp,
hz); // freq
connect(fv, &FoxVerifier::verifyComplete, this, &MainWindow::handleVerifyMsg);
m_verifications << fv;
} else {
}
#endif
{
if (ui->labDXped->text() == "Super Hound" && decodedtext0.mid(3, 18).contains(" verified")) {
verified = true;
write_all("Vf",decodedtext0.string());
@ -10201,7 +10207,7 @@ void MainWindow::on_comboBoxHoundSort_activated(int index)
{
if(index!=-99) houndCallers(); //Silence compiler warning
}
#ifdef FOX_OTP
QString MainWindow::foxOTPcode()
{
QString code;
@ -10228,6 +10234,7 @@ QString MainWindow::foxOTPcode()
}
return code;
}
#endif
//------------------------------------------------------------------------------
QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
@ -10602,6 +10609,7 @@ void MainWindow::foxTxSequencer()
goto Transmit;
}
#ifdef FOX_OTP
// Send OTP message maybe for regular fox mode
if (!m_config.superFox() && m_config.OTPEnabled() && (islot < m_Nslots) && (m_tFoxTxSinceOTP >= m_config.OTPinterval()))
{
@ -10612,6 +10620,7 @@ void MainWindow::foxTxSequencer()
islot++;
foxGenWaveform(islot - 1, fm);
}
#endif
//Compile list1: up to NSLots Hound calls to be sent RR73
for(QString hc: m_foxQSO.keys()) { //Check all Hound calls: First priority

11459
widgets/mainwindow.cppNEW Normal file

File diff suppressed because it is too large Load Diff

View File

@ -896,7 +896,7 @@ private:
void read_log();
void refreshPileupList();
QString userAgent();
void handleVerifyMsg(int status, QDateTime ts, QString callsign, QString code, QString const &response);
void handleVerifyMsg(int status, QDateTime ts, QString callsign, QString code, unsigned int hz, QString const &response);
void writeFoxTxMsgs();
QString foxOTPcode();
};