Added CMD. Fixed sending of spots over the network API. Changed the basic response of QUERY MSGS

This commit is contained in:
Jordan Sherer 2019-01-31 14:04:44 -05:00
parent 03f351551d
commit 78c1c9f1cf
3 changed files with 44 additions and 27 deletions

View File

@ -454,7 +454,6 @@ private:
Q_SLOT void on_add_macro_push_button_clicked (bool = false);
Q_SLOT void on_delete_macro_push_button_clicked (bool = false);
Q_SLOT void on_PTT_method_button_group_buttonClicked (int);
Q_SLOT void on_station_message_line_edit_textChanged(QString const&);
Q_SLOT void on_groups_line_edit_textChanged(QString const&);
Q_SLOT void on_qth_message_line_edit_textChanged(QString const&);
Q_SLOT void on_cq_message_line_edit_textChanged(QString const&);
@ -1157,7 +1156,6 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
ui_->callsign_line_edit->setValidator (new CallsignValidator {this});
ui_->grid_line_edit->setValidator (new MaidenheadLocatorValidator {this, MaidenheadLocatorValidator::Length::doubleextended});
ui_->add_macro_line_edit->setValidator (new QRegExpValidator {message_alphabet, this});
ui_->station_message_line_edit->setValidator (new QRegExpValidator {message_alphabet, this});
ui_->qth_message_line_edit->setValidator (new QRegExpValidator {message_alphabet, this});
ui_->reply_message_line_edit->setValidator (new QRegExpValidator {message_alphabet, this});
ui_->cq_message_line_edit->setValidator (new QRegExpValidator {message_alphabet, this});
@ -1166,7 +1164,6 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
setUppercase(ui_->callsign_line_edit);
setUppercase(ui_->grid_line_edit);
setUppercase(ui_->add_macro_line_edit);
setUppercase(ui_->station_message_line_edit);
setUppercase(ui_->qth_message_line_edit);
setUppercase(ui_->reply_message_line_edit);
setUppercase(ui_->cq_message_line_edit);
@ -2782,11 +2779,6 @@ void Configuration::impl::on_sound_output_combo_box_currentTextChanged (QString
default_audio_output_device_selected_ = QAudioDeviceInfo::defaultOutputDevice ().deviceName () == text;
}
void Configuration::impl::on_station_message_line_edit_textChanged(QString const &text)
{
}
void Configuration::impl::on_groups_line_edit_textChanged(QString const &text)
{
}

View File

@ -9954,18 +9954,32 @@ void MainWindow::processCommandActivity() {
continue;
}
// PROCESS BUFFERED CMD
else if (d.cmd == " CMD" && ui->autoReplyButton->isChecked()){
qDebug() << "skipping incoming command" << d.text;
// make sure this is explicit
continue;
}
// PROCESS BUFFERED QUERY
else if (d.cmd == " QUERY" && ui->autoReplyButton->isChecked()){
qDebug() << "received raw query" << d.text;
QStringList segs = d.text.split(" ");
if(segs.isEmpty()){
continue;
}
// NOOP
continue;
auto cmd = segs.first();
segs.removeFirst();
if(cmd == "MSG"){
}
}
// PROCESS BUFFERED QUERY MSGS
else if (d.cmd == " QUERY MSGS" && ui->autoReplyButton->isChecked()){
auto who = d.from;
auto cmd =
auto inbox = Inbox(inboxPath());
if(!inbox.open()){
@ -9976,19 +9990,16 @@ void MainWindow::processCommandActivity() {
foreach(auto pair, v){
auto params = pair.second.params();
auto text = params.value("TEXT").toString().trimmed();
auto from = params.value("FROM").toString();
if(!text.isEmpty()){
// mark as delivered
pair.second.setType("DELIVERED");
inbox.set(pair.first, pair.second);
// and then reply with the text
reply = QString("%1>%2 DE %3").arg(who).arg(text).arg(from);
reply = QString("%1 YES").arg(who);
break;
}
}
reply = replies.join("\n");
// if this is not an allcall and we have no messages, reply no.
if(!isAllCall && reply.isEmpty()){
reply = QString("%1 NO").arg(who);
}
}
// PROCESS BUFFERED QUERY CALL
@ -10266,6 +10277,9 @@ void MainWindow::processSpots() {
return;
}
// Get the dial frequency to report
auto dial = dialFrequency();
// Process spots to be sent...
pskSetLocal();
aprsSetLocal();
@ -10275,9 +10289,19 @@ void MainWindow::processSpots() {
if(d.call.isEmpty()){
continue;
}
qDebug() << "spotting call to reporting networks" << d.call << d.snr << d.freq;
pskLogReport("JS8", d.freq, d.snr, d.call, d.grid);
aprsLogReport(d.freq, d.snr, d.call, d.grid);
sendNetworkMessage("RX.SPOT", "", {
{"DIAL", QVariant(dial)},
{"OFFSET", QVariant(d.freq)},
{"CALL", QVariant(d.call)},
{"SNR", QVariant(d.snr)},
{"GRID", QVariant(d.grid)},
});
}
}

View File

@ -92,7 +92,7 @@ QMap<QString, int> directed_cmds = {
{" QSL?", 22 }, // do you copy?
{" QSL", 23 }, // i copy
// {" ", 24 }, // unused
{" CMD", 24 }, // open ended command
{" SNR", 25 }, // seen a station at the provided snr
{" NO", 26 }, // negative confirm
@ -105,13 +105,13 @@ QMap<QString, int> directed_cmds = {
};
// commands allowed to be processed
QSet<int> allowed_cmds = {-1, 0, 1, /*2,*/ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /*16,*/ 17, 18, 19, 20, 21, 22, 23, /*24,*/ 25, 26, 27, 28, 29, 30, 31};
QSet<int> allowed_cmds = {-1, 0, 1, /*2,*/ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /*16,*/ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
// commands that result in an autoreply
QSet<int> autoreply_cmds = {0, 1, 3, 4, 6, 10, 12, 13, 30};
// commands that result in an autoreply (which can be relayed)
QSet<int> autoreply_cmds = {0, 1, 3, 4, 6, 10, 11, 12, 13, 30};
// commands that should be buffered
QSet<int> buffered_cmds = {3, 5, /*6,*/ /*7,*/ 10, 11, 12, 13, 14, 15};
QSet<int> buffered_cmds = {3, 5, /*6,*/ /*7,*/ 10, 11, 12, 13, 14, 15, 24};
// commands that may include an SNR value
QSet<int> snr_cmds = {25, 29};
@ -124,11 +124,12 @@ QMap<int, int> checksum_cmds = {
{ 12, 16 },
{ 13, 16 },
{ 14, 16 },
{ 15, 0 }
{ 15, 0 },
{ 24, 16 }
};
QString callsign_pattern = QString("(?<callsign>[@]?[A-Z0-9/]+)");
QString optional_cmd_pattern = QString("(?<cmd>\\s?(?:AGN[?]|QSL[?]|HW CPY[?]|APRS[:]|MSG TO[:]|SNR[?]|QTH[?]|GRID[?]|STATUS[?]|HEARING[?]|(?:(?:STATUS|HEARING|QUERY CALL|QUERY MSGS|QUERY|ACK|73|YES|NO|SNR|QSL|RR|SK|FB|QTH|GRID|TU)(?=[ ]|$))|[?> ]))?");
QString optional_cmd_pattern = QString("(?<cmd>\\s?(?:AGN[?]|QSL[?]|HW CPY[?]|APRS[:]|MSG TO[:]|SNR[?]|QTH[?]|GRID[?]|STATUS[?]|HEARING[?]|(?:(?:STATUS|HEARING|QUERY CALL|QUERY MSGS|QUERY|CMD|ACK|73|YES|NO|SNR|QSL|RR|SK|FB|QTH|GRID|TU)(?=[ ]|$))|[?> ]))?");
QString optional_grid_pattern = QString("(?<grid>\\s?[A-R]{2}[0-9]{2})?");
QString optional_extended_grid_pattern = QString("^(?<grid>\\s?(?:[A-R]{2}[0-9]{2}(?:[A-X]{2}(?:[0-9]{2})?)*))?");
QString optional_num_pattern = QString("(?<num>(?<=SNR|ACK)\\s?[-+]?(?:3[01]|[0-2]?[0-9]))?");