mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-17 17:42:02 -05:00
ad643f3353
- This gets rid of the need to configure for parallel or serial port - The code picks up the device name from WSJT.INI for ComPort (misnamed now) which is actually a device name for either a serial port or parallel port. ptt_unix.c then uses the appropriate code to "talk" to a parallel or serial port. - audio in/audio out should work the same way on windows as it did before, however it is actually now a string name value, which can be used to open the appropriate /dev/dsp on OSS or in future, be passed to the ALSA init routines or other audio routines as needed. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@185 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
43 lines
813 B
C
43 lines
813 B
C
#include <windows.h>
|
|
#include <stdio.h>
|
|
|
|
int ptt_(int *nport, char *unused, int *ntx, int *iptt)
|
|
{
|
|
static HANDLE hFile;
|
|
static int open=0;
|
|
char s[10];
|
|
int i3,i4,i5,i6,i9,i00;
|
|
|
|
if(*nport==0) {
|
|
*iptt=*ntx;
|
|
return(0);
|
|
}
|
|
|
|
if(*ntx && (!open)) {
|
|
sprintf(s,"COM%d",*nport);
|
|
hFile=CreateFile(TEXT(s),GENERIC_WRITE,0,NULL,OPEN_EXISTING,
|
|
FILE_ATTRIBUTE_NORMAL,NULL);
|
|
if(hFile==INVALID_HANDLE_VALUE) {
|
|
printf("PTT: Cannot open COM port %d.\n",*nport);
|
|
return(1);
|
|
}
|
|
open=1;
|
|
}
|
|
|
|
if(*ntx && open) {
|
|
EscapeCommFunction(hFile,3);
|
|
EscapeCommFunction(hFile,5);
|
|
*iptt=1;
|
|
}
|
|
|
|
else {
|
|
EscapeCommFunction(hFile,4);
|
|
EscapeCommFunction(hFile,6);
|
|
EscapeCommFunction(hFile,9);
|
|
i00=CloseHandle(hFile);
|
|
*iptt=0;
|
|
open=0;
|
|
}
|
|
return(0);
|
|
}
|