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
#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_10->setStyleSheet("QLabel{background-color: #aabec8}");
@ -649,6 +655,11 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
}
}
#endif
#ifdef unix
psk_Reporter->setLocalStation(m_myCall,m_myGrid, "WSJT-X r" + rev.mid(6,4) );
#endif
m_pskReporter=dlg.m_pskReporter;
m_After73=dlg.m_After73;
@ -1331,6 +1342,22 @@ void MainWindow::readFromStdout() //readFromStdout
}
}
#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 "soundout.h"
#include "commons.h"
#include "psk_reporter.h"
#ifdef WIN32
#include "PSKReporter.h"
@ -315,6 +316,8 @@ private:
QSharedMemory *mem_jt9;
PSK_Reporter *psk_Reporter;
//---------------------------------------------------- private functions
void readSettings();
void writeSettings();

View File

@ -2,7 +2,6 @@
// Implemented by Edson Pereira PY2SDR
//
// 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"
@ -37,7 +36,6 @@ PSK_Reporter::PSK_Reporter(QObject *parent) :
reportTimer = new QTimer(this);
connect(reportTimer, SIGNAL(timeout()), this, SLOT(sendReport()));
reportTimer->start(5*60*1000); // 5 minutes;
}
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_rxGrid = gridSquare;
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 )
@ -61,6 +60,9 @@ void PSK_Reporter::addRemoteStation(QString call, QString grid, QString freq, QS
void PSK_Reporter::sendReport()
{
if (m_spotQueue.isEmpty())
return;
// Header
QString header_h = m_header_h;
header_h.replace("tttttttt", QString("%1").arg(QDateTime::currentDateTime().toTime_t(),8,16,QChar('0')));
@ -75,24 +77,21 @@ void PSK_Reporter::sendReport()
rxInfoData_h += "0000";
rxInfoData_h.replace("50E2llll", "50E2" + QString("%1").arg(rxInfoData_h.length()/2,4,16,QChar('0')));
// Sender information
QString txInfoData_h;
if (!m_spotQueue.isEmpty()) {
txInfoData_h = "50E3llll";
while (!m_spotQueue.isEmpty()) {
QHash<QString,QString> 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(spot["time"].toInt(),8,16,QChar('0'));
}
txInfoData_h += "0000";
txInfoData_h.replace("50E3llll", "50E3" + QString("%1").arg(txInfoData_h.length()/2,4,16,QChar('0')));
// Sender information
QString txInfoData_h = "50E3llll";
while (!m_spotQueue.isEmpty()) {
QHash<QString,QString> 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(spot["time"].toInt(),8,16,QChar('0'));
}
txInfoData_h += "0000";
txInfoData_h.replace("50E3llll", "50E3" + QString("%1").arg(txInfoData_h.length()/2,4,16,QChar('0')));
// Build report
QString report_h = header_h + m_rxInfoDescriptor_h + m_txInfoDescriptor_h + rxInfoData_h + txInfoData_h;