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
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
ui->label_9->setStyleSheet("QLabel{background-color: #aabec8}");
@ -780,7 +780,7 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
#ifdef UNIX
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
@ -1521,6 +1521,7 @@ void MainWindow::readFromStdout() //readFromStdout
}
#else
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 snr= QString::number(nsnr);
if(gridOK(g2)) {

View File

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

View File

@ -10,7 +10,7 @@ class PSK_Reporter : public QObject
Q_OBJECT
public:
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);
signals:
@ -27,6 +27,7 @@ private:
QString m_rxCall;
QString m_rxGrid;
QString m_rxAnt;
QString m_progId;
QQueue< QHash<QString,QString> > m_spotQueue;