Renamed QUERY to QUERY CALL. Added generic user QUERY with no auto-reply (for scripting).

This commit is contained in:
Jordan Sherer 2018-12-31 20:03:51 -05:00
parent b7792fe30c
commit 81a22ab8b8
2 changed files with 22 additions and 9 deletions

View File

@ -7188,7 +7188,7 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){
addMessageText(QString("%1>[MESSAGE]").arg(selectedCall), true, true); addMessageText(QString("%1>[MESSAGE]").arg(selectedCall), true, true);
}); });
auto qsoQueryAction = menu->addAction(QString("%1 QUERY [CALLSIGN]? - Please acknowledge you can communicate directly with [CALLSIGN]").arg(call).trimmed()); auto qsoQueryAction = menu->addAction(QString("%1 QUERY CALL [CALLSIGN]? - Please acknowledge you can communicate directly with [CALLSIGN]").arg(call).trimmed());
connect(qsoQueryAction, &QAction::triggered, this, [this](){ connect(qsoQueryAction, &QAction::triggered, this, [this](){
QString selectedCall = callsignSelected(); QString selectedCall = callsignSelected();
@ -7196,7 +7196,7 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){
return; return;
} }
addMessageText(QString("%1 QUERY [CALLSIGN]?").arg(selectedCall), true, true); addMessageText(QString("%1 QUERY CALL [CALLSIGN]?").arg(selectedCall), true, true);
}); });
auto agnAction = menu->addAction(QString("%1 AGN? - Please automatically repeat your last transmission").arg(call).trimmed()); auto agnAction = menu->addAction(QString("%1 AGN? - Please automatically repeat your last transmission").arg(call).trimmed());
@ -9597,13 +9597,19 @@ void MainWindow::processCommandActivity() {
// PROCESS BUFFERED QUERY // PROCESS BUFFERED QUERY
else if (d.cmd == " QUERY" && ui->autoReplyButton->isChecked()){ else if (d.cmd == " QUERY" && ui->autoReplyButton->isChecked()){
qDebug() << "received raw query" << d.text;
// NOOP
continue;
}
// PROCESS BUFFERED QUERY CALL
else if (d.cmd == " QUERY CALL" && ui->autoReplyButton->isChecked()){
auto who = d.text; auto who = d.text;
if(who.isEmpty()){ if(who.isEmpty()){
continue; continue;
} }
// TODO: here is where we would process arbitrary queries if we wanted
auto callsigns = Varicode::parseCallsigns(who); auto callsigns = Varicode::parseCallsigns(who);
if(callsigns.isEmpty()){ if(callsigns.isEmpty()){
continue; continue;
@ -9622,6 +9628,11 @@ void MainWindow::processCommandActivity() {
replies.append(r); replies.append(r);
} }
} }
if(!replies.isEmpty()){
replies.prepend(QString("%1 YES").arg(d.from));
}
reply = replies.join("\n"); reply = replies.join("\n");
if(!reply.isEmpty()){ if(!reply.isEmpty()){

View File

@ -62,7 +62,8 @@ QMap<QString, int> directed_cmds = {
{" STATUS?", 6 }, // query idle message {" STATUS?", 6 }, // query idle message
//{"!", 7 }, // unused //{"!", 7 }, // unused
//{"#", 8 }, // unused
{" HEARING", 8 }, // these are the stations i'm hearing
{" TU", 9 }, // thank you {" TU", 9 }, // thank you
@ -70,9 +71,9 @@ QMap<QString, int> directed_cmds = {
// {" ", 10 }, // unused // {" ", 10 }, // unused
// {" ", 11 }, // unused // {" ", 11 }, // unused
{" HEARING", 12 }, // these are the stations i'm hearing
{" QUERY", 13 }, // can you transmit a ping to callsign? {" QUERY", 12 }, // issue a generic query
{" QUERY CALL", 13 }, // can you transmit a ping to callsign?
{" APRS:", 14 }, // send an aprs packet {" APRS:", 14 }, // send an aprs packet
@ -99,19 +100,20 @@ QMap<QString, int> directed_cmds = {
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};
QSet<int> buffered_cmds = {3, 5, /*6,*/ /*7,*/ 13, 14, 15}; QSet<int> buffered_cmds = {3, 5, /*6,*/ /*7,*/ 12, 13, 14, 15};
QSet<int> snr_cmds = {25, 29}; QSet<int> snr_cmds = {25, 29};
QMap<int, int> checksum_cmds = { QMap<int, int> checksum_cmds = {
{ 5, 16 }, { 5, 16 },
{ 12, 16 },
{ 13, 16 }, { 13, 16 },
{ 14, 16 }, { 14, 16 },
{ 15, 0 } { 15, 0 }
}; };
QString callsign_pattern = QString("(?<callsign>[@]?[A-Z0-9/]+)"); QString callsign_pattern = QString("(?<callsign>[@]?[A-Z0-9/]+)");
QString optional_cmd_pattern = QString("(?<cmd>\\s?(?:AGN[?]|QSL[?]|HW CPY[?]|APRS[:]|SNR[?]|QTC[?]|QTH[?]|GRID[?]|STATUS[?]|HEARING[?]|(?:(?:HEARING|QUERY|ACK|73|YES|NO|SNR|QSL|RR|SK|FB|QTH|QTC|GRID|TU)(?=[ ]|$))|[?> ]))?"); QString optional_cmd_pattern = QString("(?<cmd>\\s?(?:AGN[?]|QSL[?]|HW CPY[?]|APRS[:]|SNR[?]|QTC[?]|QTH[?]|GRID[?]|STATUS[?]|HEARING[?]|(?:(?:HEARING|QUERY CALL|QUERY|ACK|73|YES|NO|SNR|QSL|RR|SK|FB|QTH|QTC|GRID|TU)(?=[ ]|$))|[?> ]))?");
QString optional_grid_pattern = QString("(?<grid>\\s?[A-R]{2}[0-9]{2})?"); 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_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]))?"); QString optional_num_pattern = QString("(?<num>(?<=SNR|ACK)\\s?[-+]?(?:3[01]|[0-2]?[0-9]))?");