mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-11 02:09:03 -04:00
Merging code for v1.1 back into the main wsjtx branch.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3462 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
+39
-2
@@ -1,11 +1,19 @@
|
||||
#include "getfile.h"
|
||||
#include <QDir>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <err.h>
|
||||
#endif
|
||||
|
||||
void getfile(QString fname, int ntrperiod)
|
||||
@@ -123,6 +131,7 @@ float gran()
|
||||
|
||||
int ptt(int nport, int ntx, int* iptt, int* nopen)
|
||||
{
|
||||
// qDebug() << "getfile ptt(), line 129:" << nport << ntx << *iptt << *nopen;
|
||||
#ifdef WIN32
|
||||
static HANDLE hFile;
|
||||
char s[10];
|
||||
@@ -130,7 +139,7 @@ int ptt(int nport, int ntx, int* iptt, int* nopen)
|
||||
|
||||
if(nport==0) {
|
||||
*iptt=ntx;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(ntx && (!(*nopen))) {
|
||||
@@ -160,6 +169,34 @@ int ptt(int nport, int ntx, int* iptt, int* nopen)
|
||||
*nopen=0;
|
||||
}
|
||||
if((i3+i4+i5+i6+i9+i00)==-999) return 1; //Silence compiler warning
|
||||
// qDebug() << "getfile ptt(), line 167:" << nport << ntx << *iptt << *nopen;
|
||||
return 0;
|
||||
#else
|
||||
// qDebug() << "getfile ptt(), line 170:" << nport << ntx << *iptt << *nopen;
|
||||
// ptt_(nport,ntx, iptt, nopen);
|
||||
|
||||
// int control=TIOCM_RTS | TIOCM_DTR;
|
||||
int control = TIOCM_RTS;
|
||||
static int fd;
|
||||
|
||||
if(*nopen==0) {
|
||||
fd=open("/dev/ttyUSB0",O_RDWR | O_NONBLOCK);
|
||||
if(fd<0) {
|
||||
return -1;
|
||||
}
|
||||
*nopen=1;
|
||||
}
|
||||
|
||||
if(ntx) {
|
||||
ioctl(fd, TIOCMBIS, &control);
|
||||
*iptt=1;
|
||||
*nopen=1;
|
||||
} else {
|
||||
ioctl(fd, TIOCMBIC, &control);
|
||||
close(fd);
|
||||
*iptt=0;
|
||||
*nopen=0;
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
if((nport+ntx+(*iptt)==-99999)) *nopen=0; //Silence compiler warning
|
||||
|
||||
Reference in New Issue
Block a user