Added antenna info to PSK_Reporter class. Needs more testing since PSK Reporter web site seems down at the moment.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3497 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Edson W. R. Pereira 2013-07-21 19:54:38 +00:00
parent f932f2a1da
commit 785bee8122
3 changed files with 36 additions and 26 deletions

View File

@ -322,7 +322,7 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QString *thekey, QWidget *parent)
#ifdef UNIX #ifdef UNIX
psk_Reporter = new PSK_Reporter(this); psk_Reporter = new PSK_Reporter(this);
psk_Reporter->setLocalStation(m_myCall,m_myGrid, "WSJT-X r" + rev.mid(6,4) ); psk_Reporter->setLocalStation(m_myCall,m_myGrid, m_pskAntenna, "WSJT-X r" + rev.mid(6,4) );
#endif #endif
ui->label_9->setStyleSheet("QLabel{background-color: #aabec8}"); ui->label_9->setStyleSheet("QLabel{background-color: #aabec8}");
@ -780,7 +780,7 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
#ifdef UNIX #ifdef UNIX
if(m_pskReporter) { if(m_pskReporter) {
psk_Reporter->setLocalStation(m_myCall,m_myGrid, "WSJT-X r" + rev.mid(6,4) ); psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_pskAntenna, "WSJT-X r" + rev.mid(6,4) );
} }
#endif #endif
@ -1521,6 +1521,7 @@ void MainWindow::readFromStdout() //readFromStdout
} }
#else #else
if(m_pskReporter and b and !m_diskData and okToPost) { if(m_pskReporter and b and !m_diskData and okToPost) {
psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_pskAntenna, "WSJT-X r" + rev.mid(6,4) );
QString freq = QString::number(nfreq); QString freq = QString::number(nfreq);
QString snr= QString::number(nsnr); QString snr= QString::number(nsnr);
if(gridOK(g2)) { if(gridOK(g2)) {

View File

@ -12,10 +12,11 @@ PSK_Reporter::PSK_Reporter(QObject *parent) :
m_header_h = "000Allllttttttttssssssssiiiiiiii"; m_header_h = "000Allllttttttttssssssssiiiiiiii";
// We use 50E2 and 50E3 for link Id // We use 50E2 and 50E3 for link Id
m_rxInfoDescriptor_h = "0003002450E200030000" m_rxInfoDescriptor_h = "0003002C50E200040000"
"8002FFFF0000768F" // 2. Rx Call "8002FFFF0000768F" // 2. Rx Call
"8004FFFF0000768F" // 4. Rx Grid "8004FFFF0000768F" // 4. Rx Grid
"8008FFFF0000768F" // 8. Rx Soft "8008FFFF0000768F" // 8. Rx Soft
"8009FFFF0000768F" // 9. Rx Antenna
"0000"; "0000";
m_txInfoDescriptor_h = "0002003C50E30007" m_txInfoDescriptor_h = "0002003C50E30007"
@ -35,14 +36,15 @@ 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 antenna, QString programInfo)
{ {
m_rxCall = call; m_rxCall = call;
m_rxGrid = gridSquare; m_rxGrid = gridSquare;
m_rxAnt = antenna;
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 )
@ -59,8 +61,7 @@ void PSK_Reporter::addRemoteStation(QString call, QString grid, QString freq, QS
void PSK_Reporter::sendReport() void PSK_Reporter::sendReport()
{ {
if (m_spotQueue.isEmpty()) QString report_h;
return;
// Header // Header
QString header_h = m_header_h; QString header_h = m_header_h;
@ -73,28 +74,35 @@ void PSK_Reporter::sendReport()
rxInfoData_h += QString("%1").arg(m_rxCall.length(),2,16,QChar('0')) + m_rxCall.toUtf8().toHex(); rxInfoData_h += QString("%1").arg(m_rxCall.length(),2,16,QChar('0')) + m_rxCall.toUtf8().toHex();
rxInfoData_h += QString("%1").arg(m_rxGrid.length(),2,16,QChar('0')) + m_rxGrid.toUtf8().toHex(); rxInfoData_h += QString("%1").arg(m_rxGrid.length(),2,16,QChar('0')) + m_rxGrid.toUtf8().toHex();
rxInfoData_h += QString("%1").arg(m_progId.length(),2,16,QChar('0')) + m_progId.toUtf8().toHex(); rxInfoData_h += QString("%1").arg(m_progId.length(),2,16,QChar('0')) + m_progId.toUtf8().toHex();
rxInfoData_h += QString("%1").arg(m_rxAnt.length(),2,16,QChar('0')) + m_rxAnt.toUtf8().toHex();
rxInfoData_h += "0000"; rxInfoData_h += "0000";
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 = "50E3llll"; if (! m_spotQueue.isEmpty()) {
while (!m_spotQueue.isEmpty()) { QString txInfoData_h = "50E3llll";
QHash<QString,QString> spot = m_spotQueue.dequeue(); while (!m_spotQueue.isEmpty()) {
txInfoData_h += QString("%1").arg(spot["call"].length(),2,16,QChar('0')) + spot["call"].toUtf8().toHex(); QHash<QString,QString> spot = m_spotQueue.dequeue();
txInfoData_h += QString("%1").arg(spot["freq"].toLongLong(),8,16,QChar('0')); txInfoData_h += QString("%1").arg(spot["call"].length(),2,16,QChar('0')) + spot["call"].toUtf8().toHex();
txInfoData_h += QString("%1").arg(spot["snr"].toInt(),8,16,QChar('0')).right(2); txInfoData_h += QString("%1").arg(spot["freq"].toLongLong(),8,16,QChar('0'));
txInfoData_h += QString("%1").arg(spot["mode"].length(),2,16,QChar('0')) + spot["mode"].toUtf8().toHex(); txInfoData_h += QString("%1").arg(spot["snr"].toInt(),8,16,QChar('0')).right(2);
txInfoData_h += QString("%1").arg(spot["grid"].length(),2,16,QChar('0')) + spot["grid"].toUtf8().toHex(); txInfoData_h += QString("%1").arg(spot["mode"].length(),2,16,QChar('0')) + spot["mode"].toUtf8().toHex();
txInfoData_h += QString("%1").arg(1,2,16,QChar('0')); // REPORTER_SOURCE_AUTOMATIC txInfoData_h += QString("%1").arg(spot["grid"].length(),2,16,QChar('0')) + spot["grid"].toUtf8().toHex();
txInfoData_h += QString("%1").arg(spot["time"].toInt(),8,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";
txInfoData_h.replace("50E3llll", "50E3" + QString("%1").arg(txInfoData_h.length()/2,4,16,QChar('0')));
report_h = header_h + m_rxInfoDescriptor_h + m_txInfoDescriptor_h + rxInfoData_h + txInfoData_h;
qDebug() << "Sending Report TX: ";
} else {
report_h = header_h + m_rxInfoDescriptor_h + rxInfoData_h;
qDebug() << "Sending Report RX: ";
} }
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;
report_h.replace("000Allll", "000A" + QString("%1").arg(report_h.length()/2,4,16,QChar('0'))); report_h.replace("000Allll", "000A" + QString("%1").arg(report_h.length()/2,4,16,QChar('0')));
QByteArray report = QByteArray::fromHex(report_h.toUtf8()); QByteArray report = QByteArray::fromHex(report_h.toUtf8());
qDebug() << report;
// Get IP address for pskreporter.info and send report via UDP // Get IP address for pskreporter.info and send report via UDP
QHostInfo info = QHostInfo::fromName("report.pskreporter.info"); QHostInfo info = QHostInfo::fromName("report.pskreporter.info");

View File

@ -10,7 +10,7 @@ class PSK_Reporter : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit PSK_Reporter(QObject *parent = 0); explicit PSK_Reporter(QObject *parent = 0);
void setLocalStation(QString call, QString grid, QString programInfo); void setLocalStation(QString call, QString grid, QString antenna, QString programInfo);
void addRemoteStation(QString call, QString grid, QString freq, QString mode, QString snr, QString time); void addRemoteStation(QString call, QString grid, QString freq, QString mode, QString snr, QString time);
signals: signals:
@ -27,6 +27,7 @@ private:
QString m_rxCall; QString m_rxCall;
QString m_rxGrid; QString m_rxGrid;
QString m_rxAnt;
QString m_progId; QString m_progId;
QQueue< QHash<QString,QString> > m_spotQueue; QQueue< QHash<QString,QString> > m_spotQueue;