Added indicators for callsigns who can hear you

This commit is contained in:
Jordan Sherer 2018-09-29 17:04:05 -04:00
parent 4426dc77dc
commit e5f4cd4753
2 changed files with 28 additions and 10 deletions

View File

@ -1479,6 +1479,7 @@ void MainWindow::initializeDummyData(){
cd.call = call; cd.call = call;
cd.freq = 500 + 100*i; cd.freq = 500 + 100*i;
cd.snr = i == 3 ? -100 : i; cd.snr = i == 3 ? -100 : i;
cd.ackTimestamp = i == 1 ? dt.addSecs(-900) : QDateTime{};
cd.utcTimestamp = dt; cd.utcTimestamp = dt;
cd.grid = i == 5 ? "J042" : i == 6 ? "FN42FN42FN" : ""; cd.grid = i == 5 ? "J042" : i == 6 ? "FN42FN42FN" : "";
logCallActivity(cd, false); logCallActivity(cd, false);
@ -3958,6 +3959,9 @@ void MainWindow::logCallActivity(CallDetail d, bool spot){
if(d.grid.isEmpty() && !old.grid.isEmpty()){ if(d.grid.isEmpty() && !old.grid.isEmpty()){
d.grid = old.grid; d.grid = old.grid;
} }
if(!d.ackTimestamp.isValid() && old.ackTimestamp.isValid()){
d.ackTimestamp = old.ackTimestamp;
}
m_callActivity[d.call] = d; m_callActivity[d.call] = d;
} else { } else {
// create // create
@ -6594,11 +6598,6 @@ void MainWindow::prepareBeacon(){
// FT8Call Style // FT8Call Style
if(m_txBeaconQueue.isEmpty()){ if(m_txBeaconQueue.isEmpty()){
lines.append(QString("%1: BEACON %2").arg(mycall).arg(mygrid)); lines.append(QString("%1: BEACON %2").arg(mycall).arg(mygrid));
bool shouldTransmitTwoBeacons = true;
if(shouldTransmitTwoBeacons){
lines.append(QString("%1: BEACON %2").arg(mycall).arg(mygrid));
}
} else { } else {
while(!m_txBeaconQueue.isEmpty() && lines.length() < 2){ while(!m_txBeaconQueue.isEmpty() && lines.length() < 2){
lines.append(m_txBeaconQueue.dequeue()); lines.append(m_txBeaconQueue.dequeue());
@ -9140,6 +9139,10 @@ void MainWindow::processRxActivity() {
continue; continue;
} }
if(d.isDirected && d.text.contains("BEACON")){
continue;
}
// use the actual frequency and check its delta from our current frequency // use the actual frequency and check its delta from our current frequency
// meaning, if our current offset is 1502 and the d.freq is 1492, the delta is <= 10; // meaning, if our current offset is 1502 and the d.freq is 1492, the delta is <= 10;
bool shouldDisplay = abs(d.freq - currentFreqOffset()) <= 10; bool shouldDisplay = abs(d.freq - currentFreqOffset()) <= 10;
@ -9152,6 +9155,7 @@ void MainWindow::processRxActivity() {
} }
#endif #endif
#if 0
// if this is a (recent) directed offset, bump the cache, and display... // if this is a (recent) directed offset, bump the cache, and display...
// this will allow a directed free text command followed by non-buffered data frames. // this will allow a directed free text command followed by non-buffered data frames.
bool isDirectedAllCall = false; bool isDirectedAllCall = false;
@ -9159,13 +9163,16 @@ void MainWindow::processRxActivity() {
markOffsetDirected(d.freq, isDirectedAllCall); markOffsetDirected(d.freq, isDirectedAllCall);
shouldDisplay = shouldDisplay || !isDirectedAllCall; shouldDisplay = shouldDisplay || !isDirectedAllCall;
} }
#endif
if(!shouldDisplay){ if(!shouldDisplay){
continue; continue;
} }
#if 0
// ok, we're good to display...let's cache that fact and then display! // ok, we're good to display...let's cache that fact and then display!
markOffsetRecent(d.freq); markOffsetRecent(d.freq);
#endif
bool isFirst = (d.bits & Varicode::FT8CallFirst) == Varicode::FT8CallFirst; bool isFirst = (d.bits & Varicode::FT8CallFirst) == Varicode::FT8CallFirst;
bool isLast = (d.bits & Varicode::FT8CallLast) == Varicode::FT8CallLast; bool isLast = (d.bits & Varicode::FT8CallLast) == Varicode::FT8CallLast;
@ -9395,6 +9402,9 @@ void MainWindow::processCommandActivity() {
continue; continue;
} }
// is this to me?
bool toMe = d.to == m_config.my_callsign().trimmed() || d.to == Radio::base_callsign(m_config.my_callsign()).trimmed();
// log call activity... // log call activity...
CallDetail cd = {}; CallDetail cd = {};
cd.call = d.from; cd.call = d.from;
@ -9402,11 +9412,10 @@ void MainWindow::processCommandActivity() {
cd.snr = d.snr; cd.snr = d.snr;
cd.freq = d.freq; cd.freq = d.freq;
cd.bits = d.bits; cd.bits = d.bits;
cd.ackTimestamp = d.text.contains("BEACON ACK") || toMe ? d.utcTimestamp : QDateTime{};
cd.utcTimestamp = d.utcTimestamp; cd.utcTimestamp = d.utcTimestamp;
logCallActivity(cd, true); logCallActivity(cd, true);
bool toMe = d.to == m_config.my_callsign().trimmed() || d.to == Radio::base_callsign(m_config.my_callsign()).trimmed();
// we're only responding to allcall and our callsign at this point, so we'll end after logging the callsigns we've heard // we're only responding to allcall and our callsign at this point, so we'll end after logging the callsigns we've heard
if (!isAllCall && !toMe) { if (!isAllCall && !toMe) {
continue; continue;
@ -9419,7 +9428,7 @@ void MainWindow::processCommandActivity() {
#endif #endif
// if this is an allcall, check to make sure we haven't replied to their allcall recently (in the past beacon interval) // if this is an allcall, check to make sure we haven't replied to their allcall recently (in the past beacon interval)
// that way we never get spammed by allcalls at a high frequency than what we would beacon // that way we never get spammed by allcalls at a higher frequency than what we would normally beacon
if (isAllCall && m_txAllcallCommandCache.contains(d.from) && m_txAllcallCommandCache[d.from]->secsTo(now) / 60 < m_config.beacon()) { if (isAllCall && m_txAllcallCommandCache.contains(d.from) && m_txAllcallCommandCache[d.from]->secsTo(now) / 60 < m_config.beacon()) {
continue; continue;
} }
@ -9449,6 +9458,12 @@ void MainWindow::processCommandActivity() {
// we'd be double printing here if were on frequency, so let's be "smart" about this... // we'd be double printing here if were on frequency, so let's be "smart" about this...
bool shouldDisplay = true; bool shouldDisplay = true;
// don't display beacon allcalls
if(isAllCall && ad.text.contains("BEACON")){
shouldDisplay = false;
}
if(shouldDisplay){ if(shouldDisplay){
auto c = ui->textEditRX->textCursor(); auto c = ui->textEditRX->textCursor();
c.movePosition(QTextCursor::End); c.movePosition(QTextCursor::End);
@ -9491,7 +9506,7 @@ void MainWindow::processCommandActivity() {
} }
// and mark the offset as a directed offset so future free text is displayed // and mark the offset as a directed offset so future free text is displayed
markOffsetDirected(ad.freq, isAllCall); // markOffsetDirected(ad.freq, isAllCall);
// construct a reply, if needed // construct a reply, if needed
QString reply; QString reply;
@ -9930,6 +9945,7 @@ void MainWindow::displayActivity(bool force) {
m_rxDisplayDirty = false; m_rxDisplayDirty = false;
} }
// updateBandActivity
void MainWindow::displayBandActivity() { void MainWindow::displayBandActivity() {
auto now = DriftingDateTime::currentDateTimeUtc(); auto now = DriftingDateTime::currentDateTimeUtc();
@ -10147,6 +10163,7 @@ void MainWindow::displayBandActivity() {
ui->tableWidgetRXAll->setUpdatesEnabled(true); ui->tableWidgetRXAll->setUpdatesEnabled(true);
} }
// updateCallActivity
void MainWindow::displayCallActivity() { void MainWindow::displayCallActivity() {
auto now = DriftingDateTime::currentDateTimeUtc(); auto now = DriftingDateTime::currentDateTimeUtc();
@ -10257,7 +10274,7 @@ void MainWindow::displayCallActivity() {
#if SHOW_THROUGH_CALLS #if SHOW_THROUGH_CALLS
QString displayCall = d.through.isEmpty() ? d.call : QString("%1>%2").arg(d.through).arg(d.call); QString displayCall = d.through.isEmpty() ? d.call : QString("%1>%2").arg(d.through).arg(d.call);
#else #else
QString displayCall = d.call; QString displayCall = d.ackTimestamp.isValid() ? QString("%1 *").arg(d.call) : d.call;
#endif #endif
auto displayItem = new QTableWidgetItem(displayCall); auto displayItem = new QTableWidgetItem(displayCall);
displayItem->setData(Qt::UserRole, QVariant((d.call))); displayItem->setData(Qt::UserRole, QVariant((d.call)));

View File

@ -680,6 +680,7 @@ private:
QString through; QString through;
QString grid; QString grid;
int freq; int freq;
QDateTime ackTimestamp;
QDateTime utcTimestamp; QDateTime utcTimestamp;
int snr; int snr;
int bits; int bits;