mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-10-27 02:50:39 -04:00 
			
		
		
		
	WIP toward sending decodes from Q65W to WSJT-X through shared memory.
This commit is contained in:
		
							parent
							
								
									439f17c123
								
							
						
					
					
						commit
						a60edeb607
					
				| @ -33,9 +33,9 @@ set (libq65_FSRCS | ||||
|   f77_wisdom.f | ||||
|   ) | ||||
| 
 | ||||
| set (libq65_CXXSRCS | ||||
|   ipcomm.cpp | ||||
|   ) | ||||
| #set (libq65_CXXSRCS | ||||
| #  ipcomm.cpp | ||||
| #  ) | ||||
| 
 | ||||
| set (libq65_C_and_CXXSRCS | ||||
|   ${libq65_CSRCS} | ||||
|  | ||||
| @ -1,34 +0,0 @@ | ||||
| #include <QDebug> | ||||
| #include <qsharedmemory.h> | ||||
| #include <QSystemSemaphore> | ||||
| 
 | ||||
| QSharedMemory mem_m65("mem_m65"); | ||||
| QSystemSemaphore sem_m65("sem_m65", 1, QSystemSemaphore::Open); | ||||
| 
 | ||||
| extern "C" { | ||||
|   bool attach_m65_(); | ||||
|   bool create_m65_(int nsize); | ||||
|   bool detach_m65_(); | ||||
|   bool lock_m65_(); | ||||
|   bool unlock_m65_(); | ||||
|   char* address_m65_(); | ||||
|   int size_m65_(); | ||||
| 
 | ||||
|   bool acquire_m65_(); | ||||
|   bool release_m65_(); | ||||
| 
 | ||||
|   extern struct { | ||||
|     char c[10]; | ||||
|   } m65com_; | ||||
| } | ||||
| 
 | ||||
| bool attach_m65_() {return mem_m65.attach();} | ||||
| bool create_m65_(int nsize) {return mem_m65.create(nsize);} | ||||
| bool detach_m65_() {return mem_m65.detach();} | ||||
| bool lock_m65_() {return mem_m65.lock();} | ||||
| bool unlock_m65_() {return mem_m65.unlock();} | ||||
| char* address_m65_() {return (char*)mem_m65.constData();} | ||||
| int size_m65_() {return (int)mem_m65.size();} | ||||
| 
 | ||||
| bool acquire_m65_() {return sem_m65.acquire();} | ||||
| bool release_m65_() {return sem_m65.release();} | ||||
| @ -24,8 +24,6 @@ subroutine q65c(itimer) | ||||
|        mcall3,nkeep,ntol,nxant,nrxlog,nfsample,nxpol,nmode,               & | ||||
|        ndop00,nsave,max_drift,nhsym,mycall,mygrid,hiscall,hisgrid,        & | ||||
|        datetime,junk1,junk2 | ||||
| !### REMEMBER that /npar/ is not updated until nparams=nparams0 is executed. ### | ||||
| 
 | ||||
|   equivalence (nparams,fcenter) | ||||
|   data first/.true./ | ||||
|   save first | ||||
| @ -38,10 +36,6 @@ subroutine q65c(itimer) | ||||
|   endif | ||||
| 
 | ||||
|   datetime(18:20)=':00' | ||||
| 
 | ||||
| !  if(first) call timer('q65w    ',0) | ||||
| !  first=.false. | ||||
| 
 | ||||
|   npatience=1 | ||||
|   call timer('decode0 ',0) | ||||
|   call decode0(dd,ss,savg) | ||||
|  | ||||
| @ -957,6 +957,13 @@ void MainWindow::guiUpdate() | ||||
|       ui->decodedTextBrowser->append(t.trimmed()); | ||||
|       m_fetched++; | ||||
|     } | ||||
|     mem_q65w.lock(); | ||||
| 
 | ||||
| //    char *from = (char*) decodes_.ndecodes;
 | ||||
| //    char *from = (char*) &decodes_;
 | ||||
|     memcpy((char*)ipc_wsjtx, &decodes_, sizeof(decodes_)); | ||||
| 
 | ||||
|     mem_q65w.unlock(); | ||||
|   } | ||||
| 
 | ||||
|   if(nsec != m_sec0) {                                     //Once per second
 | ||||
|  | ||||
| @ -191,7 +191,6 @@ int volatile itone[MAX_NUM_SYMBOLS];   //Audio tones for all Tx symbols | ||||
| int volatile itone0[MAX_NUM_SYMBOLS];  //Dummy array, data not actually used
 | ||||
| int volatile icw[NUM_CW_SYMBOLS];        //Dits for CW ID
 | ||||
| dec_data_t dec_data;                // for sharing with Fortran
 | ||||
| 
 | ||||
| int outBufSize; | ||||
| int rc; | ||||
| qint32  g_iptt {0}; | ||||
| @ -213,6 +212,11 @@ bool no_a7_decodes = false; | ||||
| bool keep_frequency = false; | ||||
| 
 | ||||
| QSharedMemory mem_q65w("mem_q65w");         //Memory segment to be shared (optionally) with Q65W
 | ||||
| struct { | ||||
|   int ndecodes; | ||||
|   int ncand; | ||||
|   char result[50][60]; | ||||
| } q65wcom; | ||||
| int* ipc_q65w; | ||||
| 
 | ||||
| namespace | ||||
| @ -3404,6 +3408,7 @@ void MainWindow::decode()                                       //decode() | ||||
|         narg[13]=-1; | ||||
|         narg[14]=m_config.aggressive(); | ||||
|         memcpy(d2b,dec_data.d2,2*360000); | ||||
|         m_fetched=0; | ||||
|         watcher3.setFuture (QtConcurrent::run (std::bind (fast_decode_, &d2b[0], | ||||
|             &narg[0],&m_TRperiod, &m_msg[0][0], dec_data.params.mycall, | ||||
|             dec_data.params.hiscall, (FCL)8000, (FCL)12, (FCL)12))); | ||||
| @ -4806,12 +4811,18 @@ void MainWindow::guiUpdate() | ||||
| 
 | ||||
| //Once per second (onesec)
 | ||||
|   if(nsec != m_sec0) { | ||||
| //    mem_q65w.lock();
 | ||||
| //    ipc_q65w[0]=nsec;
 | ||||
| //    qDebug() << "AAA" << nsec << ipc_q65w[0] << ipc_q65w[1];
 | ||||
| //    mem_q65w.unlock();
 | ||||
| 
 | ||||
|     if(m_mode=="Q65") { | ||||
| 
 | ||||
|       mem_q65w.lock(); | ||||
|       memcpy(&q65wcom, (char*)ipc_q65w, sizeof(q65wcom)); | ||||
|       qDebug() << "AAA" << nsec << q65wcom.ndecodes << q65wcom.ncand << m_fetched; | ||||
|       QString t0=QString::fromLatin1(q65wcom.result[0]); | ||||
|       QString t1=QString::fromLatin1(q65wcom.result[1]); | ||||
|       qDebug() << "BBB" << t0 << "\n" << t1; | ||||
|       mem_q65w.unlock(); | ||||
| 
 | ||||
|       QFileInfo fi(m_appDir+"/q65w_decodes.txt"); | ||||
|       QDateTime fileTime=fi.lastModified(); | ||||
|       QDateTime now = QDateTime::currentDateTimeUtc (); | ||||
|  | ||||
| @ -509,6 +509,7 @@ private: | ||||
|   qint32  m_score=0; | ||||
|   qint32  m_fDop=0; | ||||
|   qint32  m_echoSec0=0; | ||||
|   qint32  m_fetched=0; | ||||
| 
 | ||||
|   bool    m_btxok;		//True if OK to transmit
 | ||||
|   bool    m_diskData; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user