Initial tests with new PSK Reporter interface. Only on UNIX for now.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3186 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Edson W. R. Pereira 2013-04-16 20:15:25 +00:00
parent 9a2da454da
commit 9757527030
3 changed files with 48 additions and 19 deletions

View File

@ -286,6 +286,12 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QWidget *parent) :
} }
} }
#endif #endif
#ifdef unix
psk_Reporter = new PSK_Reporter(this);
psk_Reporter->setLocalStation(m_myCall,m_myGrid, "WSJT-X r" + rev.mid(6,4) );
#endif
ui->label_9->setStyleSheet("QLabel{background-color: #aabec8}"); ui->label_9->setStyleSheet("QLabel{background-color: #aabec8}");
ui->label_10->setStyleSheet("QLabel{background-color: #aabec8}"); ui->label_10->setStyleSheet("QLabel{background-color: #aabec8}");
@ -649,6 +655,11 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
} }
} }
#endif #endif
#ifdef unix
psk_Reporter->setLocalStation(m_myCall,m_myGrid, "WSJT-X r" + rev.mid(6,4) );
#endif
m_pskReporter=dlg.m_pskReporter; m_pskReporter=dlg.m_pskReporter;
m_After73=dlg.m_After73; m_After73=dlg.m_After73;
@ -1331,6 +1342,22 @@ void MainWindow::readFromStdout() //readFromStdout
} }
} }
#endif #endif
#ifdef unix
if(b and !m_diskData) {
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 snr= QString::number(t.mid(10,3).toInt());
psk_Reporter->addRemoteStation(c2,grid,freq,"JT9",snr,QString::number(QDateTime::currentDateTime().toTime_t()));
}
#endif
} }
} }
} }

View File

@ -6,6 +6,7 @@
#include "soundin.h" #include "soundin.h"
#include "soundout.h" #include "soundout.h"
#include "commons.h" #include "commons.h"
#include "psk_reporter.h"
#ifdef WIN32 #ifdef WIN32
#include "PSKReporter.h" #include "PSKReporter.h"
@ -315,6 +316,8 @@ private:
QSharedMemory *mem_jt9; QSharedMemory *mem_jt9;
PSK_Reporter *psk_Reporter;
//---------------------------------------------------- private functions //---------------------------------------------------- private functions
void readSettings(); void readSettings();
void writeSettings(); void writeSettings();

View File

@ -2,7 +2,6 @@
// Implemented by Edson Pereira PY2SDR // Implemented by Edson Pereira PY2SDR
// //
// Reports will be sent in batch mode every 5 minutes. // Reports will be sent in batch mode every 5 minutes.
// If there are no spots to be sent, a report will be sent with only the receiver station info.
#include "psk_reporter.h" #include "psk_reporter.h"
@ -37,7 +36,6 @@ PSK_Reporter::PSK_Reporter(QObject *parent) :
reportTimer = new QTimer(this); reportTimer = new QTimer(this);
connect(reportTimer, SIGNAL(timeout()), this, SLOT(sendReport())); connect(reportTimer, SIGNAL(timeout()), this, SLOT(sendReport()));
reportTimer->start(5*60*1000); // 5 minutes;
} }
void PSK_Reporter::setLocalStation(QString call, QString gridSquare, QString programInfo) void PSK_Reporter::setLocalStation(QString call, QString gridSquare, QString programInfo)
@ -45,6 +43,7 @@ void PSK_Reporter::setLocalStation(QString call, QString gridSquare, QString pro
m_rxCall = call; m_rxCall = call;
m_rxGrid = gridSquare; m_rxGrid = gridSquare;
m_progId = programInfo; m_progId = programInfo;
reportTimer->start(5*60*1000); // 5 minutes;
} }
void PSK_Reporter::addRemoteStation(QString call, QString grid, QString freq, QString mode, QString snr, QString time ) void PSK_Reporter::addRemoteStation(QString call, QString grid, QString freq, QString mode, QString snr, QString time )
@ -61,6 +60,9 @@ void PSK_Reporter::addRemoteStation(QString call, QString grid, QString freq, QS
void PSK_Reporter::sendReport() void PSK_Reporter::sendReport()
{ {
if (m_spotQueue.isEmpty())
return;
// Header // Header
QString header_h = m_header_h; QString header_h = m_header_h;
header_h.replace("tttttttt", QString("%1").arg(QDateTime::currentDateTime().toTime_t(),8,16,QChar('0'))); header_h.replace("tttttttt", QString("%1").arg(QDateTime::currentDateTime().toTime_t(),8,16,QChar('0')));
@ -76,9 +78,7 @@ void PSK_Reporter::sendReport()
rxInfoData_h.replace("50E2llll", "50E2" + QString("%1").arg(rxInfoData_h.length()/2,4,16,QChar('0'))); rxInfoData_h.replace("50E2llll", "50E2" + QString("%1").arg(rxInfoData_h.length()/2,4,16,QChar('0')));
// Sender information // Sender information
QString txInfoData_h; QString txInfoData_h = "50E3llll";
if (!m_spotQueue.isEmpty()) {
txInfoData_h = "50E3llll";
while (!m_spotQueue.isEmpty()) { while (!m_spotQueue.isEmpty()) {
QHash<QString,QString> spot = m_spotQueue.dequeue(); QHash<QString,QString> spot = m_spotQueue.dequeue();
qDebug() << spot; qDebug() << spot;
@ -92,7 +92,6 @@ void PSK_Reporter::sendReport()
} }
txInfoData_h += "0000"; txInfoData_h += "0000";
txInfoData_h.replace("50E3llll", "50E3" + QString("%1").arg(txInfoData_h.length()/2,4,16,QChar('0'))); txInfoData_h.replace("50E3llll", "50E3" + QString("%1").arg(txInfoData_h.length()/2,4,16,QChar('0')));
}
// Build report // Build report
QString report_h = header_h + m_rxInfoDescriptor_h + m_txInfoDescriptor_h + rxInfoData_h + txInfoData_h; QString report_h = header_h + m_rxInfoDescriptor_h + m_txInfoDescriptor_h + rxInfoData_h + txInfoData_h;