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 23e3b9e953
commit 59ede5936c
6 changed files with 137 additions and 88 deletions

View File

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

View File

@ -18,9 +18,7 @@ subroutine jt9a
common/tracer/limtrace,lu common/tracer/limtrace,lu
call getcwd(cwd) call getcwd(cwd)
! call ftninit(trim(cwd))
open(12,file='timer.out',status='unknown') open(12,file='timer.out',status='unknown')
open(14,file='wsjtx_rx.log',status='unknown',position='append')
limtrace=0 limtrace=0
lu=12 lu=12
@ -88,15 +86,6 @@ subroutine jt9c(ss,savg,c0,id2,nparams0)
npatience=1 npatience=1
call flush(6) 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 nstandalone=0
if(sum(nparams).ne.0) call decoder(ss,c0) if(sum(nparams).ne.0) call decoder(ss,c0)

View File

@ -1,4 +1,4 @@
//-------------------------------------------------------------- MainWindow //--------------------------------------------------------------- MainWindow
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "devsetup.h" #include "devsetup.h"
@ -31,9 +31,6 @@ MainWindow::MainWindow(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
#ifdef WIN32
freopen("wsjtx.log","w",stderr);
#endif
on_EraseButton_clicked(); on_EraseButton_clicked();
ui->labUTC->setStyleSheet( \ ui->labUTC->setStyleSheet( \
"QLabel { background-color : black; color : yellow; }"); "QLabel { background-color : black; color : yellow; }");
@ -177,6 +174,8 @@ MainWindow::MainWindow(QWidget *parent) :
genStdMsgs("-30"); genStdMsgs("-30");
on_actionWide_Waterfall_triggered(); //### on_actionWide_Waterfall_triggered(); //###
g_pWideGraph->setTxFreq(m_txFreq); g_pWideGraph->setTxFreq(m_txFreq);
m_dialFreq=g_pWideGraph->dialFreq();
if(m_mode=="JT9-1") on_actionJT9_1_triggered(); if(m_mode=="JT9-1") on_actionJT9_1_triggered();
if(m_mode=="JT9-2") on_actionJT9_2_triggered(); if(m_mode=="JT9-2") on_actionJT9_2_triggered();
if(m_mode=="JT9-5") on_actionJT9_5_triggered(); if(m_mode=="JT9-5") on_actionJT9_5_triggered();
@ -1014,6 +1013,17 @@ void MainWindow::readFromStdout() //readFromStdout
m_startAnother=m_loopall; m_startAnother=m_loopall;
return; return;
} else { } 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(); int n=t.length();
QString bg="white"; QString bg="white";
if(t.indexOf(" CQ ")>0) bg="#66ff66"; //Light green if(t.indexOf(" CQ ")>0) bg="#66ff66"; //Light green
@ -1023,6 +1033,23 @@ void MainWindow::readFromStdout() //readFromStdout
ui->decodedTextBrowser->append(t); ui->decodedTextBrowser->append(t);
QString msg=t.mid(34,22); QString msg=t.mid(34,22);
bool b=stdmsg_(msg.toAscii().constData()); 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 and !m_diskData) {
// if(m_pskReporterInit and b) { // if(m_pskReporterInit and b) {
int i1=msg.indexOf(" "); 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) { if((iptt==1 && iptt0==0) || m_restart) {
QByteArray ba; QByteArray ba;
if(m_ntx == 1) ba=ui->tx1->text().toLocal8Bit(); if(m_ntx == 1) ba=ui->tx1->text().toLocal8Bit();
@ -1164,16 +1191,36 @@ void MainWindow::guiUpdate()
genjt9_(message,&ichk,msgsent,itone,&itext,len1,len1); genjt9_(message,&ichk,msgsent,itone,&itext,len1,len1);
msgsent[22]=0; msgsent[22]=0;
lab5->setText("Last Tx: " + QString::fromAscii(msgsent)); lab5->setText("Last Tx: " + QString::fromAscii(msgsent));
QString t=QString::fromAscii(msgsent);
if(m_restart) { if(m_restart) {
QFile f("wsjtx_tx.log"); QFile f("ALL.TXT");
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
QTextStream out(&f); QTextStream out(&f);
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm") out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
<< " Tx message: " << QString::fromAscii(msgsent) << endl; << " Tx message: " << t << endl;
f.close(); 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; m_restart=false;
} }
@ -1187,7 +1234,7 @@ void MainWindow::guiUpdate()
btxok=true; btxok=true;
m_transmitting=true; m_transmitting=true;
QFile f("wsjtx_tx.log"); QFile f("ALL.TXT");
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
QTextStream out(&f); QTextStream out(&f);
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm") 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(); double dialFreq=g_pWideGraph->dialFreq();
QDateTime t = QDateTime::currentDateTimeUtc(); 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"); QFile f("wsjtx.log");
if(!f.open(QFile::Append)) { if(!f.open(QFile::Append)) {
msgBox("Cannot open file \"wsjtx.log\"."); 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 QFile f2("wsjtx_log.adi");
{ if(!f2.open(QFile::Append)) {
int ret = QMessageBox::warning(this, "Confirm Erase", msgBox("Cannot open file \"wsjtx_log.adi\".");
"Are you sure you want to erase file wsjtx_rx.log ?", } else {
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if(ret==QMessageBox::Yes) {
m_RxLog |= 2; // Rewind wsjtx_rx.log
}
}
void MainWindow::on_actionErase_wsjtx_tx_log_triggered() //Erase Tx log QTextStream out(&f2);
{ if(f2.size()==0) out << "WSJT-X ADIF Export<eoh>" << endl;
int ret = QMessageBox::warning(this, "Confirm Erase", /*
"Are you sure you want to erase file wsjtx_tx.log ?", <CALL:5>K1ABC<GRIDSQUARE:4>FN42<MODE:4>JT65<RST_RCVD:3>-15
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); <RST_SENT:3>-17<QSO_DATE:0><TIME_ON:4>1355<TIME_OFF:4>1357
if(ret==QMessageBox::Yes) { <TX_PWR:1>5<COMMENT:3>Jim<STATION_CALLSIGN:4>K1JT<MY_GRIDSQUARE:4>FN20<eor>
QFile f("wsjtx_tx.log"); */
f.remove(); 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() void MainWindow::on_actionJT9_1_triggered()
@ -1816,3 +1874,25 @@ void MainWindow::on_actionMonitor_OFF_at_startup_triggered()
{ {
m_monitorStartOFF=!m_monitorStartOFF; 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_dxGridEntry_textChanged(const QString &arg1);
void on_genStdMsgsPushButton_clicked(); void on_genStdMsgsPushButton_clicked();
void on_logQSOButton_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_actionAFMHot_triggered();
void on_actionBlue_triggered(); void on_actionBlue_triggered();
void on_actionJT9_2_triggered(); void on_actionJT9_2_triggered();
@ -111,6 +109,10 @@ private slots:
void on_actionMonitor_OFF_at_startup_triggered(); void on_actionMonitor_OFF_at_startup_triggered();
void dialFreqChanged2(double f); void dialFreqChanged2(double f);
void on_actionErase_ALL_TXT_triggered();
void on_actionErase_wsjtx_log_adi_triggered();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
@ -206,6 +208,10 @@ private:
QString m_dateTime; QString m_dateTime;
QString m_mode; QString m_mode;
QString m_fname; QString m_fname;
QString m_rptSent;
QString m_rptRcvd;
QString m_qsoStart;
QString m_qsoStop;
SoundInThread soundInThread; //Instantiate the audio threads SoundInThread soundInThread; //Instantiate the audio threads
SoundOutThread soundOutThread; SoundOutThread soundOutThread;

View File

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

View File

@ -52,18 +52,7 @@ WideGraph::WideGraph(QWidget *parent) :
m_qsoFreq=settings.value("QSOfreq",1010).toInt(); m_qsoFreq=settings.value("QSOfreq",1010).toInt();
ui->widePlot->setFQSO(m_qsoFreq,true); ui->widePlot->setFQSO(m_qsoFreq,true);
settings.endGroup(); settings.endGroup();
emit dialFreqChanged(m_dialFreq);
// 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\".";
}
} }
WideGraph::~WideGraph() WideGraph::~WideGraph()