Replace GROUPCALL with actual group calls

This commit is contained in:
Jordan Sherer 2018-10-27 10:09:40 -04:00
parent 47a7c06854
commit 121bb0fdb5
6 changed files with 33 additions and 37 deletions

View File

@ -936,8 +936,8 @@ QString Configuration::my_station() const
return station.trimmed();
}
QStringList Configuration::my_groups() const {
return m_->my_groups_;
QSet<QString> Configuration::my_groups() const {
return QSet<QString>::fromList(m_->my_groups_);
}
QString Configuration::my_qth() const

View File

@ -98,7 +98,7 @@ public:
QString my_callsign () const;
QString my_grid () const;
QString my_station () const;
QStringList my_groups() const;
QSet<QString> my_groups() const;
int activity_aging() const;
int callsign_aging() const;
QString my_qth () const;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>750</width>
<height>735</height>
<height>748</height>
</rect>
</property>
<property name="windowTitle">
@ -247,7 +247,7 @@
<item row="5" column="1">
<widget class="QLineEdit" name="groups_line_edit">
<property name="text">
<string>@ALLCALL, @GROUPCALL</string>
<string/>
</property>
<property name="placeholderText">
<string/>

View File

@ -152,7 +152,6 @@ extern "C" {
}
const int NEAR_THRESHOLD_RX = 10;
const int NEAR_THRESHOLD_GROUPCALL = 125;
int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols
int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID
@ -4976,7 +4975,7 @@ void MainWindow::clearActivity(){
m_lastTxMessage.clear();
clearTableWidget(ui->tableWidgetCalls);
createAllcallTableRow(ui->tableWidgetCalls, false);
createAllcallTableRows(ui->tableWidgetCalls, "");
clearTableWidget(ui->tableWidgetRXAll);
@ -4990,28 +4989,14 @@ void MainWindow::clearActivity(){
update_dynamic_property(ui->extFreeTextMsgEdit, "transmitting", false);
}
void MainWindow::createAllcallTableRow(QTableWidget *table, bool selected){
table->insertRow(table->rowCount());
void MainWindow::createAllcallTableRows(QTableWidget *table, QString const &selectedCall){
int count = 0;
auto now = DriftingDateTime::currentDateTimeUtc();
int callsignAging = m_config.callsign_aging();
if(ui->selcalButton->isChecked()){
int freq = currentFreqOffset();
foreach(auto cd, m_callActivity.values()){
if (callsignAging && cd.utcTimestamp.secsTo(now) / 60 >= callsignAging) {
continue;
}
if(abs(freq - cd.freq) <= NEAR_THRESHOLD_GROUPCALL){
count++;
}
}
auto item = new QTableWidgetItem(count == 0 ? QString("GROUPCALL") : QString("GROUPCALL (%1)").arg(count));
item->setData(Qt::UserRole, QVariant("GROUPCALL"));
table->setItem(table->rowCount() - 1, 0, item);
table->setSpan(table->rowCount() - 1, 0, 1, table->columnCount());
} else {
if(!ui->selcalButton->isChecked()){
table->insertRow(table->rowCount());
foreach(auto cd, m_callActivity.values()){
if (callsignAging && cd.utcTimestamp.secsTo(now) / 60 >= callsignAging) {
continue;
@ -5022,12 +5007,26 @@ void MainWindow::createAllcallTableRow(QTableWidget *table, bool selected){
item->setData(Qt::UserRole, QVariant("ALLCALL"));
table->setItem(table->rowCount() - 1, 0, item);
table->setSpan(table->rowCount() - 1, 0, 1, table->columnCount());
if(selectedCall == "ALLCALL"){
table->item(table->rowCount()-1, 0)->setSelected(true);
}
}
if (selected) {
auto groups = m_config.my_groups().toList();
qSort(groups);
foreach(auto group, groups){
table->insertRow(table->rowCount());
auto item = new QTableWidgetItem(group);
item->setData(Qt::UserRole, QVariant(group));
table->setItem(table->rowCount() - 1, 0, item);
table->setSpan(table->rowCount() - 1, 0, 1, table->columnCount());
if(selectedCall == group){
table->item(table->rowCount()-1, 0)->setSelected(true);
}
}
}
void MainWindow::displayTextForFreq(QString text, int freq, QDateTime date, bool isTx, bool isNewLine, bool isLast){
int lowFreq = freq/10*10;
@ -6201,7 +6200,7 @@ void MainWindow::on_clearAction_triggered(QObject * sender){
if(sender == ui->tableWidgetCalls){
m_callActivity.clear();
clearTableWidget((ui->tableWidgetCalls));
createAllcallTableRow(ui->tableWidgetCalls, false);
createAllcallTableRows(ui->tableWidgetCalls, "");
}
if(sender == ui->extFreeTextMsgEdit){
@ -8087,7 +8086,7 @@ bool MainWindow::isAllCallIncluded(const QString &text){
}
bool MainWindow::isGroupCallIncluded(const QString &text){
return text.contains("GROUPCALL");
return m_config.my_groups().contains(text);
}
void MainWindow::processActivity(bool force) {
@ -8131,7 +8130,7 @@ void MainWindow::processRxActivity() {
if(hasExistingMessageBuffer(d.freq, false, &prevOffset) && (
(m_messageBuffer[prevOffset].cmd.to == m_config.my_callsign()) ||
(isAllCallIncluded(m_messageBuffer[prevOffset].cmd.to) && !ui->selcalButton->isChecked()) ||
(isGroupCallIncluded(m_messageBuffer[prevOffset].cmd.to) && abs(prevOffset - freqOffset) <= NEAR_THRESHOLD_GROUPCALL)
(isGroupCallIncluded(m_messageBuffer[prevOffset].cmd.to))
)
){
d.isBuffered = true;
@ -8414,8 +8413,7 @@ void MainWindow::processCommandActivity() {
auto d = m_rxCommandQueue.dequeue();
bool isAllCall = isAllCallIncluded(d.to);
bool isNear = abs(d.freq - freqOffset) <= NEAR_THRESHOLD_GROUPCALL; // 100Hz + a 25Hz buffer
bool isGroupCall = isGroupCallIncluded(d.to) && isNear;
bool isGroupCall = isGroupCallIncluded(d.to);
qDebug() << "try processing command" << d.from << d.to << d.cmd << d.freq << d.grid << d.extra;
@ -8443,7 +8441,7 @@ void MainWindow::processCommandActivity() {
cd.utcTimestamp = d.utcTimestamp;
logCallActivity(cd, true);
// we're only responding to allcall, groupcalls near us, and our callsign at this point, so we'll end after logging the callsigns we've heard
// we're only responding to allcall, groupcalls, and our callsign at this point, so we'll end after logging the callsigns we've heard
if (!isAllCall && !toMe && !isGroupCall) {
continue;
}
@ -9242,7 +9240,7 @@ void MainWindow::displayCallActivity() {
{
// Clear the table
clearTableWidget(ui->tableWidgetCalls);
createAllcallTableRow(ui->tableWidgetCalls, isAllCallIncluded(selectedCall) || isGroupCallIncluded(selectedCall));
createAllcallTableRows(ui->tableWidgetCalls, selectedCall); // isAllCallIncluded(selectedCall)); // || isGroupCallIncluded(selectedCall));
// Build the table
QList < QString > keys = m_callActivity.keys();

View File

@ -136,7 +136,7 @@ public slots:
void cacheActivity(QString key);
void restoreActivity(QString key);
void clearActivity();
void createAllcallTableRow(QTableWidget *table, bool selected);
void createAllcallTableRows(QTableWidget *table, const QString &selectedCall);
void displayTextForFreq(QString text, int freq, QDateTime date, bool isTx, bool isNewLine, bool isLast);
void writeNoticeTextToUI(QDateTime date, QString text);
int writeMessageTextToUI(QDateTime date, QString text, int freq, bool bold, int block=-1);

View File

@ -179,7 +179,6 @@ quint16 nmaxgrid = (1<<15)-1;
QMap<QString, quint32> basecalls = {
{ "<....>", nbasecall + 1 }, // incomplete callsign
{ "ALLCALL", nbasecall + 2 },
{ "GROUPCALL", nbasecall + 3 },
};
QMap<quint32, QString> cqs = {
@ -1652,7 +1651,6 @@ QStringList Varicode::buildMessageFrames(
bool lineStartsWithBaseCall = (
line.startsWith("ALLCALL") ||
line.startsWith("GROUPCALL") ||
line.startsWith("BEACON") ||
Varicode::startsWithCQ(line)
);