Combining wsjtx_rx.log and wsjtx_tx.log into ALL.TXT.

Implementing ADIF log.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3050 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-03-18 16:14:18 +00:00
parent 2e6e5c97dd
commit a360a64275
6 changed files with 137 additions and 88 deletions

View File

@ -8,7 +8,7 @@ subroutine decoder(ss,c0)
real ss(184,NSMAX)
character*22 msg
character*33 line
character*80 fmt,fmt14
character*80 fmt
character*20 datetime
real*4 ccfred(NSMAX)
integer*1 i1SoftSymbols(207)
@ -36,27 +36,22 @@ subroutine decoder(ss,c0)
nsps=6912
df3=1500.0/2048.0
fmt='(i4.4,i4,i5,f6.1,f8.0,i4,3x,a22)'
fmt14='(i4.4,i4,i5,f6.1,f8.0,i4,3x,a22,i8,i3)'
else if(ntrMinutes.eq.2) then
nsps=15360
df3=1500.0/2048.0
fmt='(i4.4,i4,i5,f6.1,f8.1,i4,3x,a22)'
fmt14='(i4.4,i4,i5,f6.1,f8.1,i4,3x,a22,i8,i3)'
else if(ntrMinutes.eq.5) then
nsps=40960
df3=1500.0/6144.0
fmt='(i4.4,i4,i5,f6.1,f8.1,i4,3x,a22)'
fmt14='(i4.4,i4,i5,f6.1,f8.1,i4,3x,a22,i8,i3)'
else if(ntrMinutes.eq.10) then
nsps=82944
df3=1500.0/12288.0
fmt='(i4.4,i4,i5,f6.1,f8.2,i4,3x,a22)'
fmt14='(i4.4,i4,i5,f6.1,f8.2,i4,3x,a22,i8,i3)'
else if(ntrMinutes.eq.30) then
nsps=252000
df3=1500.0/32768.0
fmt='(i4.4,i4,i5,f6.1,f8.2,i4,3x,a22)'
fmt14='(i4.4,i4,i5,f6.1,f8.2,i4,3x,a22,i8,i3)'
endif
if(nsps.eq.0) stop 'Error: bad TRperiod' !Better: return an error code###
@ -67,13 +62,6 @@ subroutine decoder(ss,c0)
call sync9(ss,nzhsym,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipk) !Compute ccfred
call timer('sync9 ',1)
! open(13,file='decoded.txt',status='unknown')
! rewind 13
if(iand(nRxLog,2).ne.0) rewind 14
if(iand(nRxLog,1).ne.0) then
! Write date and time to lu 14
endif
nRxLog=0
fgood=0.
nsps8=nsps/8
@ -111,7 +99,6 @@ subroutine decoder(ss,c0)
if(msg.ne.' ') then
write(*,fmt) nutc,nsync,nsnr,xdt,freq,ndrift,msg
write(14,fmt14) nutc,nsync,nsnr,xdt,freq,ndrift,msg,nlim,ntrMinutes
fgood=f
nsynced=1
ndecoded=1
@ -123,7 +110,6 @@ subroutine decoder(ss,c0)
if(fgood.eq.0.0) then
write(*,1020) line
write(14,1020) line
1020 format(a33)
endif
@ -132,7 +118,6 @@ subroutine decoder(ss,c0)
flush(6)
call flush(6)
call flush(14)
call timer('decoder ',1)
if(nstandalone.eq.0) call timer('decoder ',101)

View File

@ -18,9 +18,7 @@ subroutine jt9a
common/tracer/limtrace,lu
call getcwd(cwd)
! call ftninit(trim(cwd))
open(12,file='timer.out',status='unknown')
open(14,file='wsjtx_rx.log',status='unknown',position='append')
limtrace=0
lu=12
@ -88,15 +86,6 @@ subroutine jt9c(ss,savg,c0,id2,nparams0)
npatience=1
call flush(6)
if(iand(nrxlog,1).ne.0) then
write(14,1000) datetime(:17)
1000 format(/'UTC Date: 'a17/78('-'))
flush(14)
endif
if(iand(nrxlog,2).ne.0) rewind 14
! if(iand(nrxlog,4).ne.0) rewind 26
nstandalone=0
if(sum(nparams).ne.0) call decoder(ss,c0)

View File

@ -1,4 +1,4 @@
//-------------------------------------------------------------- MainWindow
//--------------------------------------------------------------- MainWindow
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "devsetup.h"
@ -31,9 +31,6 @@ MainWindow::MainWindow(QWidget *parent) :
{
ui->setupUi(this);
#ifdef WIN32
freopen("wsjtx.log","w",stderr);
#endif
on_EraseButton_clicked();
ui->labUTC->setStyleSheet( \
"QLabel { background-color : black; color : yellow; }");
@ -177,6 +174,8 @@ MainWindow::MainWindow(QWidget *parent) :
genStdMsgs("-30");
on_actionWide_Waterfall_triggered(); //###
g_pWideGraph->setTxFreq(m_txFreq);
m_dialFreq=g_pWideGraph->dialFreq();
if(m_mode=="JT9-1") on_actionJT9_1_triggered();
if(m_mode=="JT9-2") on_actionJT9_2_triggered();
if(m_mode=="JT9-5") on_actionJT9_5_triggered();
@ -1014,6 +1013,17 @@ void MainWindow::readFromStdout() //readFromStdout
m_startAnother=m_loopall;
return;
} else {
QFile f("ALL.TXT");
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
QTextStream out(&f);
if(m_RxLog & 1) {
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
<< endl;
}
out << t << endl;
f.close();
int n=t.length();
QString bg="white";
if(t.indexOf(" CQ ")>0) bg="#66ff66"; //Light green
@ -1023,6 +1033,23 @@ void MainWindow::readFromStdout() //readFromStdout
ui->decodedTextBrowser->append(t);
QString msg=t.mid(34,22);
bool b=stdmsg_(msg.toAscii().constData());
QStringList w=msg.split(" ",QString::SkipEmptyParts);
if(b and w[1]==m_myCall) {
QString tt=w[2];
int i1;
bool ok;
i1=tt.toInt(&ok);
if(ok and i1>=-50 and i1<50) {
m_rptRcvd=tt;
} else {
if(tt.mid(0,1)=="R") {
i1=tt.mid(1).toInt(&ok);
if(ok and i1>=-50 and i1<50) {
m_rptRcvd=tt.mid(1);
}
}
}
}
if(m_pskReporterInit and b and !m_diskData) {
// if(m_pskReporterInit and b) {
int i1=msg.indexOf(" ");
@ -1147,7 +1174,7 @@ void MainWindow::guiUpdate()
}
}
// Calculate Tx waveform when needed
// Calculate Tx tones when needed
if((iptt==1 && iptt0==0) || m_restart) {
QByteArray ba;
if(m_ntx == 1) ba=ui->tx1->text().toLocal8Bit();
@ -1164,16 +1191,36 @@ void MainWindow::guiUpdate()
genjt9_(message,&ichk,msgsent,itone,&itext,len1,len1);
msgsent[22]=0;
lab5->setText("Last Tx: " + QString::fromAscii(msgsent));
QString t=QString::fromAscii(msgsent);
if(m_restart) {
QFile f("wsjtx_tx.log");
QFile f("ALL.TXT");
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
QTextStream out(&f);
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
<< " Tx message: " << QString::fromAscii(msgsent) << endl;
<< " Tx message: " << t << endl;
f.close();
}
QStringList w=t.split(" ",QString::SkipEmptyParts);
QString t2=QDateTime::currentDateTimeUtc().toString("hhmm");
if(itext==0 and w[1]==m_myCall) {
t=w[2];
int i1;
bool ok;
i1=t.toInt(&ok);
if(ok and i1>=-50 and i1<50) {
m_rptSent=t;
m_qsoStart=t2;
} else {
if(t.mid(0,1)=="R") {
i1=t.mid(1).toInt(&ok);
if(ok and i1>=-50 and i1<50) {
m_rptSent=t.mid(1);
m_qsoStart=t2;
}
}
}
}
if(itext==1 or w[2]=="73") m_qsoStop=t2;
m_restart=false;
}
@ -1187,7 +1234,7 @@ void MainWindow::guiUpdate()
btxok=true;
m_transmitting=true;
QFile f("wsjtx_tx.log");
QFile f("ALL.TXT");
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
QTextStream out(&f);
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
@ -1655,38 +1702,49 @@ void MainWindow::on_logQSOButton_clicked() //Log QSO button
{
double dialFreq=g_pWideGraph->dialFreq();
QDateTime t = QDateTime::currentDateTimeUtc();
QString logEntry=t.date().toString("yyyy-MMM-dd,") +
t.time().toString("hh:mm,") + m_hisCall + "," + m_hisGrid + "," +
QString::number(dialFreq) + "," + m_mode + "\n";
QFile f("wsjtx.log");
if(!f.open(QFile::Append)) {
msgBox("Cannot open file \"wsjtx.log\".");
return;
} else {
QString logEntry=t.date().toString("yyyy-MMM-dd,") +
t.time().toString("hh:mm,") + m_hisCall + "," + m_hisGrid + "," +
QString::number(dialFreq) + "," + m_mode + "," +
m_rptSent + "," + m_rptRcvd; QTextStream out(&f);
// out << logEntry << "\r\n";
out << logEntry << endl;
f.close();
}
QTextStream out(&f);
out << logEntry << "\r\n";
f.close();
}
void MainWindow::on_actionErase_wsjtx_rx_log_triggered() //Erase Rx log
{
int ret = QMessageBox::warning(this, "Confirm Erase",
"Are you sure you want to erase file wsjtx_rx.log ?",
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if(ret==QMessageBox::Yes) {
m_RxLog |= 2; // Rewind wsjtx_rx.log
}
}
QFile f2("wsjtx_log.adi");
if(!f2.open(QFile::Append)) {
msgBox("Cannot open file \"wsjtx_log.adi\".");
} else {
void MainWindow::on_actionErase_wsjtx_tx_log_triggered() //Erase Tx log
{
int ret = QMessageBox::warning(this, "Confirm Erase",
"Are you sure you want to erase file wsjtx_tx.log ?",
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if(ret==QMessageBox::Yes) {
QFile f("wsjtx_tx.log");
f.remove();
QTextStream out(&f2);
if(f2.size()==0) out << "WSJT-X ADIF Export<eoh>" << endl;
/*
<CALL:5>K1ABC<GRIDSQUARE:4>FN42<MODE:4>JT65<RST_RCVD:3>-15
<RST_SENT:3>-17<QSO_DATE:0><TIME_ON:4>1355<TIME_OFF:4>1357
<TX_PWR:1>5<COMMENT:3>Jim<STATION_CALLSIGN:4>K1JT<MY_GRIDSQUARE:4>FN20<eor>
*/
QString t;
t="<call:" + QString::number(m_hisCall.length()) + ">" + m_hisCall;
t+="<gridsquare:" + QString::number(m_hisGrid.length()) + ">" + m_hisGrid;
t+="<mode:" + QString::number(m_mode.length()) + ">" + m_mode;
t+="<rst_sent:" + QString::number(m_rptSent.length()) + ">" + m_rptSent;
t+="<rst_rcvd:" + QString::number(m_rptRcvd.length()) + ">" + m_rptRcvd;
t+="<qso_date:0>";
t+="<time_on:4>" + m_qsoStart;
t+="<time_off:4>" + m_qsoStop;
t+="<station_callsign:" + QString::number(m_myCall.length()) + ">" + m_myCall;
t+="<my_gridsquare:" + QString::number(m_myGrid.length()) + ">" + m_myGrid;
// t.date.toString("yyyymmdd");
out << t << endl;
f2.close();
}
m_rptSent="";
m_rptRcvd="";
}
void MainWindow::on_actionJT9_1_triggered()
@ -1816,3 +1874,25 @@ void MainWindow::on_actionMonitor_OFF_at_startup_triggered()
{
m_monitorStartOFF=!m_monitorStartOFF;
}
void MainWindow::on_actionErase_ALL_TXT_triggered() //Erase ALL.TXT
{
int ret = QMessageBox::warning(this, "Confirm Erase",
"Are you sure you want to erase file ALL.TXT ?",
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if(ret==QMessageBox::Yes) {
QFile f("ALL.TXT");
f.remove();
}
}
void MainWindow::on_actionErase_wsjtx_log_adi_triggered()
{
int ret = QMessageBox::warning(this, "Confirm Erase",
"Are you sure you want to erase file wsjtx_log.adi ?",
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if(ret==QMessageBox::Yes) {
QFile f("wsjtx_log.adi");
f.remove();
}
}

View File

@ -88,8 +88,6 @@ private slots:
void on_dxGridEntry_textChanged(const QString &arg1);
void on_genStdMsgsPushButton_clicked();
void on_logQSOButton_clicked();
void on_actionErase_wsjtx_rx_log_triggered();
void on_actionErase_wsjtx_tx_log_triggered();
void on_actionAFMHot_triggered();
void on_actionBlue_triggered();
void on_actionJT9_2_triggered();
@ -111,6 +109,10 @@ private slots:
void on_actionMonitor_OFF_at_startup_triggered();
void dialFreqChanged2(double f);
void on_actionErase_ALL_TXT_triggered();
void on_actionErase_wsjtx_log_adi_triggered();
private:
Ui::MainWindow *ui;
@ -206,6 +208,10 @@ private:
QString m_dateTime;
QString m_mode;
QString m_fname;
QString m_rptSent;
QString m_rptRcvd;
QString m_qsoStart;
QString m_qsoStop;
SoundInThread soundInThread; //Instantiate the audio threads
SoundOutThread soundOutThread;

View File

@ -1191,8 +1191,8 @@ p, li { white-space: pre-wrap; }
<addaction name="actionDecode_remaining_files_in_directory"/>
<addaction name="separator"/>
<addaction name="actionDelete_all_wav_files_in_SaveDir"/>
<addaction name="actionErase_wsjtx_rx_log"/>
<addaction name="actionErase_wsjtx_tx_log"/>
<addaction name="actionErase_ALL_TXT"/>
<addaction name="actionErase_wsjtx_log_adi"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
</widget>
@ -1352,11 +1352,6 @@ p, li { white-space: pre-wrap; }
<string>Erase Band Map and Messages</string>
</property>
</action>
<action name="actionErase_wsjtx_rx_log">
<property name="text">
<string>Erase wsjtx_rx.log</string>
</property>
</action>
<action name="actionLinrad">
<property name="checkable">
<bool>true</bool>
@ -1504,11 +1499,6 @@ p, li { white-space: pre-wrap; }
<string>Available suffixes and add-on-prefixes</string>
</property>
</action>
<action name="actionErase_wsjtx_tx_log">
<property name="text">
<string>Erase wsjtx_tx.log</string>
</property>
</action>
<action name="actionJT65A">
<property name="checkable">
<bool>true</bool>
@ -1667,6 +1657,16 @@ p, li { white-space: pre-wrap; }
<string>Monitor OFF at startup</string>
</property>
</action>
<action name="actionErase_ALL_TXT">
<property name="text">
<string>Erase ALL.TXT</string>
</property>
</action>
<action name="actionErase_wsjtx_log_adi">
<property name="text">
<string>Erase wsjtx_log.adi</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

View File

@ -52,18 +52,7 @@ WideGraph::WideGraph(QWidget *parent) :
m_qsoFreq=settings.value("QSOfreq",1010).toInt();
ui->widePlot->setFQSO(m_qsoFreq,true);
settings.endGroup();
// Change the following to a slot in mainwindow; emit a corresponding
// signal here, instead.
QFile f("wsjtx_qrg.txt");
if(f.open(QFile::WriteOnly)) {
QTextStream out(&f);
out << m_dialFreq << "\r\n";
f.close();
} else {
// msgBox("Cannot open file \"wsjtx_qrg.txt\".");
qDebug() << "Cannot open file \"wsjtx_qrg.txt\".";
}
emit dialFreqChanged(m_dialFreq);
}
WideGraph::~WideGraph()