diff --git a/PSKReporter.h b/PSKReporter.h new file mode 100644 index 000000000..a6c52c488 --- /dev/null +++ b/PSKReporter.h @@ -0,0 +1,127 @@ +#pragma once + +// Main header file for the external interface to the PSK Reporter API +// For documentation see http://psk.gladstonefamily.net/PSKReporterAPI.pdf + +/* + +Copyright (c) 2008 Philip Gladstone + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + */ + + +#ifdef _DLL_OPTION_PSKREPORTER_EXPORT +#define DllImportExport __declspec ( dllexport ) +#else +#define DllImportExport __declspec ( dllimport ) +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +#define REPORTER_SOURCE_MASK 0x07 +#define REPORTER_SOURCE_AUTOMATIC 0x01 +#define REPORTER_SOURCE_LOG 0x02 +#define REPORTER_SOURCE_MANUAL 0x03 +#define REPORTER_SOURCE_TENTATIVE 0x40 +#define REPORTER_SOURCE_TEST 0x80 + +typedef struct { + wchar_t hostname[256]; + wchar_t port[32]; + bool connected; + unsigned int callsigns_sent; + unsigned int callsigns_buffered; + unsigned int callsigns_discarded; + unsigned int last_send_time; + unsigned int next_send_time; + wchar_t last_callsign_queued[24]; + unsigned int bytes_sent; + unsigned int bytes_sent_total; + unsigned int packets_sent; + unsigned int packets_sent_total; +} REPORTER_STATISTICS; + + + + +unsigned long DllImportExport __cdecl ReporterInitialize( + const wchar_t *hostname, + const wchar_t *port +); + +unsigned long DllImportExport __cdecl ReporterSeenCallsign( + const wchar_t *remoteInformation, + const wchar_t *localInformation, + unsigned long flags +); + +unsigned long DllImportExport __cdecl ReporterTickle( +); + +unsigned long DllImportExport __cdecl ReporterGetInformation( + wchar_t *buffer, + unsigned long maxlen +); + +unsigned long DllImportExport __cdecl ReporterGetStatistics( + REPORTER_STATISTICS *buffer, + unsigned long maxlen +); + +unsigned long DllImportExport __cdecl ReporterUninitialize( +); + + +unsigned long DllImportExport __stdcall ReporterInitializeSTD( + const char *hostname, + const char *port +); + +unsigned long DllImportExport __stdcall ReporterSeenCallsignSTD( + const char *remoteInformation, + const char *localInformation, + unsigned long flags +); + +unsigned long DllImportExport __stdcall ReporterTickleSTD( +); + +unsigned long DllImportExport __stdcall ReporterGetInformationSTD( + char *buffer, + unsigned long maxlen +); + +unsigned long DllImportExport __stdcall ReporterGetStatisticsSTD( + REPORTER_STATISTICS *buffer, + unsigned long maxlen +); + +unsigned long DllImportExport __stdcall ReporterUninitializeSTD( +); + +#ifdef __cplusplus +} +#endif + + diff --git a/WSJT-X_Users_Guide.docx b/WSJT-X_Users_Guide.docx index 36eb7e3c4..358b48c0a 100644 Binary files a/WSJT-X_Users_Guide.docx and b/WSJT-X_Users_Guide.docx differ diff --git a/lib/Makefile.MinGW b/lib/Makefile.MinGW index 4d7cd6fcd..d89116344 100644 --- a/lib/Makefile.MinGW +++ b/lib/Makefile.MinGW @@ -32,7 +32,7 @@ OBJS1 = pctile.o graycode.o sort.o ssort.o \ entail.o fano232.o gran.o spec9.o sync9.o decode9.o \ fil3.o redsync.o decoder.o grid2n.o n2grid.o timer.o \ decode9a.o getlags.o afc9.o fchisq.o twkfreq.o downsam9.o \ - peakdt9.o symspec2.o + peakdt9.o symspec2.o stdmsg.o libjt9.a: $(OBJS1) ar cr libjt9.a $(OBJS1) @@ -58,7 +58,8 @@ jt9test.exe: $(OBJS5) libjt9.a $(FC) -o jt9test.exe $(OBJS5) libjt9.a ../libfftw3f_win.a OBJS6 = wsjt24d.o wsjt24.o sync24.o decode24.o ps24.o flat1.o \ - xcor24.o slope.o peakup.o interleave24.o genmet24.o + xcor24.o slope.o peakup.o interleave24.o getmet24.o smo.o \ + deep24.o encode4.o chkmsg.o avemsg4.o extract4.o wsjt24d.exe: $(OBJS6) libjt9.a $(FC) -o wsjt24d.exe $(OBJS6) libjt9.a ../libfftw3f_win.a diff --git a/libpskreporter.a b/libpskreporter.a index f479d6aef..ab9185f45 100644 Binary files a/libpskreporter.a and b/libpskreporter.a differ diff --git a/mainwindow.cpp b/mainwindow.cpp index b565859cf..3d976115e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -10,6 +10,8 @@ #include int itone[85]; //Tx audio tones for 85 symbols +int rc; +wchar_t buffer[256]; bool btxok; //True if OK to transmit bool btxMute; double outputLatency; //Latency in seconds @@ -219,27 +221,16 @@ MainWindow::MainWindow(QWidget *parent) : if(ui->actionAFMHot->isChecked()) on_actionAFMHot_triggered(); if(ui->actionBlue->isChecked()) on_actionBlue_triggered(); - /* if(m_pskReporter) { - int rc=0; rc=ReporterInitialize(NULL,NULL); - qDebug() << "A" << m_pskReporter << rc; - - wchar_t buffer[256]; - rc=ReporterGetInformation(buffer,256); - qDebug() << "B" << rc << QString::fromStdWString(buffer); - - const wchar_t* tremote=L"call\0W8WNA\0gridsquare\0EM77\0freq\050280000\0mode\0JT9\0snr\0-17\0\0"; - const wchar_t* tlocal=L"station_callsign\0K1JT\0my_gridsquare\0FN20qi\0programid\0WSJT-X\0\0"; - int flags=REPORTER_SOURCE_AUTOMATIC | REPORTER_SOURCE_TEST; - rc=ReporterSeenCallsign(tremote,tlocal,flags); - rc=ReporterGetInformation(buffer,256); - qDebug() << "C" << rc << QString::fromStdWString(buffer); - rc=ReporterUninitialize(); - qDebug() << "D" << rc; + if(rc==0) { + m_pskReporterInit=true; + } else { + m_pskReporterInit=false; + rc=ReporterGetInformation(buffer,256); + msgBox(QString::fromStdWString(buffer)); + } } - */ - } // End of MainWindow constructor //--------------------------------------------------- MainWindow destructor @@ -471,6 +462,21 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog m_paInDevice=dlg.m_paInDevice; m_nDevOut=dlg.m_nDevOut; m_paOutDevice=dlg.m_paOutDevice; + if(dlg.m_pskReporter!=m_pskReporter) { + if(dlg.m_pskReporter) { + int rc=ReporterInitialize(NULL,NULL); + if(rc==0) { + m_pskReporterInit=true; + } else { + m_pskReporterInit=false; + rc=ReporterGetInformation(buffer,256); + msgBox(QString::fromStdWString(buffer)); + } + } else { + rc=ReporterUninitialize(); + m_pskReporterInit=false; + } + } m_pskReporter=dlg.m_pskReporter; if(dlg.m_restartSoundIn) { @@ -995,6 +1001,49 @@ void MainWindow::readFromStdout() //readFromStdout ui->decodedTextBrowser->setTextBackgroundColor(bg); t=t.mid(0,n-2) + " "; ui->decodedTextBrowser->append(t); + QString msg=t.mid(34,22); + bool b=stdmsg_(msg.toAscii().constData()); +// if(m_pskReporterInit and b and !m_diskData) { + if(m_pskReporterInit and b) { + qDebug() << "Uploading to PSK Reporter"; + int i1=msg.indexOf(" "); + QString c2=msg.mid(i1+1); + int i2=c2.indexOf(" "); + QString g2=c2.mid(i2+1,4); + c2=c2.mid(0,i2); + qDebug() << c2 << g2; + QString remote="call," + c2 + ","; + if(g2.mid(0,1).compare("A")>=0 and + g2.mid(0,1).compare("R")<=0 and + g2.mid(1,1).compare("A")>=0 and + g2.mid(1,1).compare("R")<=0 and + g2.mid(2,1).compare("0")>=0 and + g2.mid(2,1).compare("9")<=0 and + g2.mid(3,1).compare("0")>=0 and + g2.mid(3,1).compare("9")<=0) { + remote += "gridsquare," + g2 + ","; + } + wchar_t tremote[256]; + remote.toWCharArray(tremote); + + QString local="station_callsign," + m_myCall + "," + + "my_gridsquare," + m_myGrid + "," + + "programid,WSJT-X,programversion," + rev.mid(6,4); + wchar_t tlocal[256]; + local.toWCharArray(tlocal); + qDebug() << QString::fromWCharArray(tremote,remote.length()); + qDebug() << QString::fromWCharArray(tlocal,local.length()); + /* + const wchar_t* tremote=L"call,W8WNA,gridsquare,EM77,freq,50293000,mode,JT9,snr,-17,,"; + const wchar_t* tlocal=L"station_callsign,K1JT,my_gridsquare,FN20qi,programid,WSJT-X,,"; + int flags=REPORTER_SOURCE_AUTOMATIC | REPORTER_SOURCE_TEST; + rc=ReporterSeenCallsign(tremote,tlocal,flags); + rc=ReporterGetInformation(buffer,256); + qDebug() << "C" << rc << QString::fromStdWString(buffer); + rc=ReporterUninitialize(); + qDebug() << "D" << rc; + */ + } } } } diff --git a/mainwindow.h b/mainwindow.h index a91a9cf7f..2b0cb7146 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -161,6 +161,7 @@ private: bool m_bdecoded; bool m_monitorStartOFF; bool m_pskReporter; + bool m_pskReporterInit; char m_decoded[80]; @@ -238,7 +239,7 @@ void symspec_(int* k, int* ntrperiod, int* nsps, int* ingain, int* nb, void genjt9_(char* msg, int* ichk, char* msgsent, int itone[], int* itext, int len1, int len2); -//void decoder_(int* ntrperiod, int* ndepth, int* mRxLog, float c0[]); +bool stdmsg_(const char* msg); } #endif // MAINWINDOW_H diff --git a/wsjtx.iss b/wsjtx.iss index fedbfb010..5328f3cb7 100644 --- a/wsjtx.iss +++ b/wsjtx.iss @@ -1,6 +1,6 @@ [Setup] AppName=wsjtx -AppVerName=wsjtx Version 0.5 r3037 +AppVerName=wsjtx Version 0.5 r3038 AppCopyright=Copyright (C) 2001-2013 by Joe Taylor, K1JT DefaultDirName=c:\wsjtx DefaultGroupName=wsjtx