mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-11-04 05:50:31 -05:00 
			
		
		
		
	Change DNS loopup to slot in PSK Reporter class.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3567 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
		
							parent
							
								
									7500b4dcbb
								
							
						
					
					
						commit
						1068c00b56
					
				@ -33,6 +33,7 @@ PSK_Reporter::PSK_Reporter(QObject *parent) :
 | 
				
			|||||||
    m_randomId_h = QString("%1").arg(qrand(),8,16,QChar('0'));
 | 
					    m_randomId_h = QString("%1").arg(qrand(),8,16,QChar('0'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_udpSocket = new QUdpSocket(this);
 | 
					    m_udpSocket = new QUdpSocket(this);
 | 
				
			||||||
 | 
					    QHostInfo::lookupHost("report.pskreporter.info", this, SLOT(dnsLookupResult(QHostInfo)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    reportTimer = new QTimer(this);
 | 
					    reportTimer = new QTimer(this);
 | 
				
			||||||
    connect(reportTimer, SIGNAL(timeout()), this, SLOT(sendReport()));
 | 
					    connect(reportTimer, SIGNAL(timeout()), this, SLOT(sendReport()));
 | 
				
			||||||
@ -45,7 +46,6 @@ void PSK_Reporter::setLocalStation(QString call, QString gridSquare, QString ant
 | 
				
			|||||||
  m_rxGrid = gridSquare;
 | 
					  m_rxGrid = gridSquare;
 | 
				
			||||||
  m_rxAnt = antenna;
 | 
					  m_rxAnt = antenna;
 | 
				
			||||||
  m_progId = programInfo;
 | 
					  m_progId = programInfo;
 | 
				
			||||||
  //qDebug() << "PSK_Reporter::setLocalStation. Antenna:" << antenna;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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 )
 | 
				
			||||||
@ -104,10 +104,17 @@ void PSK_Reporter::sendReport()
 | 
				
			|||||||
    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());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Get IP address for pskreporter.info and send report via UDP
 | 
					    // Send data to PSK Reporter site
 | 
				
			||||||
    QHostInfo info = QHostInfo::fromName("report.pskreporter.info");
 | 
					    if (!m_pskReporterAddress.isNull()) {
 | 
				
			||||||
 | 
					        m_udpSocket->writeDatagram(report, m_pskReporterAddress, 4739);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void PSK_Reporter::dnsLookupResult(QHostInfo info)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
    if (!info.addresses().isEmpty()) {
 | 
					    if (!info.addresses().isEmpty()) {
 | 
				
			||||||
        m_udpSocket->writeDatagram(report,info.addresses().at(0),4739);
 | 
					        m_pskReporterAddress = info.addresses().at(0);
 | 
				
			||||||
 | 
					        qDebug() << "PSK Reporter IP: " << m_pskReporterAddress;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -18,6 +18,9 @@ signals:
 | 
				
			|||||||
public slots:
 | 
					public slots:
 | 
				
			||||||
    void sendReport();
 | 
					    void sendReport();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					private slots:
 | 
				
			||||||
 | 
					    void dnsLookupResult(QHostInfo info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    QString m_header_h;
 | 
					    QString m_header_h;
 | 
				
			||||||
    QString m_rxInfoDescriptor_h;
 | 
					    QString m_rxInfoDescriptor_h;
 | 
				
			||||||
@ -30,6 +33,8 @@ private:
 | 
				
			|||||||
    QString m_rxAnt;
 | 
					    QString m_rxAnt;
 | 
				
			||||||
    QString m_progId;
 | 
					    QString m_progId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QHostAddress m_pskReporterAddress;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QQueue< QHash<QString,QString> > m_spotQueue;
 | 
					    QQueue< QHash<QString,QString> > m_spotQueue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QUdpSocket *m_udpSocket;
 | 
					    QUdpSocket *m_udpSocket;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user