Fixed bug with hearing command response. Added status response shortcode.

This commit is contained in:
Jordan Sherer 2019-01-01 10:12:09 -05:00
parent b001356eb0
commit bedc6dd96c
3 changed files with 32 additions and 6 deletions

View File

@ -4185,6 +4185,20 @@ void MainWindow::playSoundNotification(const QString &path){
QSound::play(path);
}
bool MainWindow::hasExistingMessageBufferToMe(int *pOffset){
foreach(auto offset, m_messageBuffer.keys()){
auto buffer = m_messageBuffer[offset];
// if this is a valid buffer and it's to me...
if(buffer.cmd.utcTimestamp.isValid() && (buffer.cmd.to == m_config.my_callsign() || buffer.cmd.to == Radio::base_callsign(m_config.my_callsign()))){
if(pOffset) *pOffset = offset;
return true;
}
}
return false;
}
bool MainWindow::hasExistingMessageBuffer(int offset, bool drift, int *pPrevOffset){
if(m_messageBuffer.contains(offset)){
if(pPrevOffset) *pPrevOffset = offset;
@ -9005,6 +9019,8 @@ void MainWindow::processRxActivity() {
int freqOffset = currentFreqOffset();
qDebug() << m_messageBuffer.count() << "message buffers open";
while (!m_rxActivityQueue.isEmpty()) {
ActivityDetail d = m_rxActivityQueue.dequeue();
@ -9472,7 +9488,7 @@ void MainWindow::processCommandActivity() {
// QUERIED ACTIVE
else if (d.cmd == " STATUS?" && !isAllCall) {
reply = QString("%1 %2").arg(d.from).arg(generateStatus());
reply = QString("%1 STATUS %2").arg(d.from).arg(generateStatus());
}
// QUERIED GRID
@ -9588,7 +9604,7 @@ void MainWindow::processCommandActivity() {
m_rxCallsignCommandQueue[d.from].append(d);
QTimer::singleShot(500, this, [this, d](){
MessageBox::information_message(this, QString("A new message has been received at %1 UTC").arg(d.utcTimestamp.time().toString()));
MessageBox::information_message(this, QString("A new message was received at %1 UTC").arg(d.utcTimestamp.time().toString()));
});
}
}
@ -9717,7 +9733,7 @@ void MainWindow::processCommandActivity() {
// do not queue a reply if it's a HB and HB is not active
if((!ui->hbMacroButton->isChecked() || m_hbInterval <= 0) && d.cmd.contains("HB")){
continue;
}
// do not queue for reply if there's text in the window
@ -9725,6 +9741,15 @@ void MainWindow::processCommandActivity() {
continue;
}
// do not queue for reply if there's a buffer open to us
int bufferOffset = 0;
if(hasExistingMessageBufferToMe(&bufferOffset)){
qDebug() << "skipping reply due to open buffer" << bufferOffset << m_messageBuffer.count();
continue;
}
// add @ALLCALLs to the @ALLCALL cache
if(isAllCall){
m_txAllcallCommandCache.insert(d.from, new QDateTime(now), 25);

View File

@ -132,6 +132,7 @@ public slots:
void fastPick(int x0, int x1, int y);
void playSoundNotification(const QString &path);
bool hasExistingMessageBufferToMe(int *pOffset);
bool hasExistingMessageBuffer(int offset, bool drift, int *pPrevOffset);
void logCallActivity(CallDetail d, bool spot=true);
QString lookupCallInCompoundCache(QString const &call);

View File

@ -61,7 +61,7 @@ QMap<QString, int> directed_cmds = {
{" STATUS?", 6 }, // query idle message
//{"!", 7 }, // unused
{" STATUS", 7 }, // this is my status
{" HEARING", 8 }, // these are the stations i'm hearing
@ -98,7 +98,7 @@ QMap<QString, int> directed_cmds = {
{" ", 31 }, // send freetext
};
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,*/ 12, 13, 14, 15};
@ -113,7 +113,7 @@ QMap<int, int> checksum_cmds = {
};
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 CALL|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[?]|(?:(?:STATUS|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_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]))?");