From c53b29f46f04afbe7956f05cf6dc58889c29622c Mon Sep 17 00:00:00 2001 From: "Edson W. R. Pereira" Date: Tue, 16 Apr 2013 23:41:50 +0000 Subject: [PATCH] Update to PSK Reporter interface. Still alpha code. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3189 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 11 ++++++----- psk_reporter.cpp | 12 +++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 6094a8acc..fcd1b46f5 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,4 +1,4 @@ -//-------------------------------------------------------------- MainWindow +//--------------------------------------------------------------- MainWindow #include "mainwindow.h" #include "ui_mainwindow.h" #include "devsetup.h" @@ -1355,17 +1355,18 @@ void MainWindow::readFromStdout() //readFromStdout #ifdef unix if(b and !m_diskData) { + qDebug() << msg; int i1=msg.indexOf(" "); QString c2=msg.mid(i1+1); int i2=c2.indexOf(" "); QString g2=c2.mid(i2+1,4); c2=c2.mid(0,i2); - QString grid; - if(gridOK(g2)) grid = g2; int nHz=t.mid(22,4).toInt(); - QString freq = QString::number(1000000.0*m_dialFreq + nHz + 0.5); + QString freq = QString::number((int)(1000000.0*m_dialFreq + nHz + 0.5)); + qDebug() << freq; QString snr= QString::number(t.mid(10,3).toInt()); - psk_Reporter->addRemoteStation(c2,grid,freq,"JT9",snr,QString::number(QDateTime::currentDateTime().toTime_t())); + if(gridOK(g2)) + psk_Reporter->addRemoteStation(c2,g2,freq,"JT9",snr,QString::number(QDateTime::currentDateTime().toTime_t())); } #endif } diff --git a/psk_reporter.cpp b/psk_reporter.cpp index 522714da7..a05ff51e2 100644 --- a/psk_reporter.cpp +++ b/psk_reporter.cpp @@ -32,7 +32,6 @@ PSK_Reporter::PSK_Reporter(QObject *parent) : m_randomId_h = QString("%1").arg(qrand(),8,16,QChar('0')); m_udpSocket = new QUdpSocket(this); - m_udpSocket->bind(QHostAddress::LocalHost,14739); // Force udp source port reportTimer = new QTimer(this); connect(reportTimer, SIGNAL(timeout()), this, SLOT(sendReport())); @@ -43,7 +42,7 @@ void PSK_Reporter::setLocalStation(QString call, QString gridSquare, QString pro m_rxCall = call; m_rxGrid = gridSquare; m_progId = programInfo; - reportTimer->start(5*60*1000); // 5 minutes; + reportTimer->start(1*60*1000); // 5 minutes; } void PSK_Reporter::addRemoteStation(QString call, QString grid, QString freq, QString mode, QString snr, QString time ) @@ -63,6 +62,8 @@ void PSK_Reporter::sendReport() if (m_spotQueue.isEmpty()) return; + qDebug() << m_rxCall << m_rxGrid << m_progId; + // Header QString header_h = m_header_h; header_h.replace("tttttttt", QString("%1").arg(QDateTime::currentDateTime().toTime_t(),8,16,QChar('0'))); @@ -81,13 +82,12 @@ void PSK_Reporter::sendReport() QString txInfoData_h = "50E3llll"; while (!m_spotQueue.isEmpty()) { QHash spot = m_spotQueue.dequeue(); - qDebug() << spot; txInfoData_h += QString("%1").arg(spot["call"].length(),2,16,QChar('0')) + spot["call"].toUtf8().toHex(); txInfoData_h += QString("%1").arg(spot["freq"].toLongLong(),8,16,QChar('0')); txInfoData_h += QString("%1").arg(spot["snr"].toInt(),1,16,QChar('0')).mid(14,2); txInfoData_h += QString("%1").arg(spot["mode"].length(),2,16,QChar('0')) + spot["mode"].toUtf8().toHex(); txInfoData_h += QString("%1").arg(spot["grid"].length(),2,16,QChar('0')) + spot["grid"].toUtf8().toHex(); - txInfoData_h += QString("%1").arg(1,2,16,QChar('0'));; + txInfoData_h += QString("%1").arg(1,2,16,QChar('0')); // REPORTER_SOURCE_AUTOMATIC txInfoData_h += QString("%1").arg(spot["time"].toInt(),8,16,QChar('0')); } txInfoData_h += "0000"; @@ -99,15 +99,17 @@ void PSK_Reporter::sendReport() QByteArray report = QByteArray::fromHex(report_h.toUtf8()); // Get IP address for pskreporter.info and send report via UDP - QHostInfo info = QHostInfo::fromName("pskreporter.info"); + QHostInfo info = QHostInfo::fromName("report.pskreporter.info"); m_udpSocket->writeDatagram(report,info.addresses().at(0),4739); + /* qDebug() << header_h; qDebug() << m_rxInfoDescriptor_h; qDebug() << m_txInfoDescriptor_h; qDebug() << rxInfoData_h; qDebug() << txInfoData_h; qDebug() << report.toHex(); + */ }