pull/1551/head
Mike Black W9MDB 2024-04-30 17:28:03 -05:00
rodzic d683955811
commit 105c6b8d39
2 zmienionych plików z 131 dodań i 1 usunięć

Wyświetl plik

@ -8,7 +8,7 @@ DISTCLEANFILES =
bin_PROGRAMS =
check_PROGRAMS = simelecraft simicgeneric simkenwood simyaesu simic9100 simic9700 simft991 simftdx1200 simftdx3000 simjupiter simpowersdr simid5100 simft736 simftdx5000 simtmd700 simrotorez simspid simft817 simts590 simft847 simic7300 simic7000 simic7100 simic7200 simatd578 simic905 simts450 simic7600 simic7610 simic705 simts950 simts990 simic7851 simftdx101 simxiegug90 simqrplabs simft818 simic275 simtrusdx simft1000 simtmd710 simts890 simxiegux108g simxiegux6100 simic910 simft450 simelecraftk4
check_PROGRAMS = simelecraft simicgeneric simkenwood simyaesu simic9100 simic9700 simft991 simftdx1200 simftdx3000 simjupiter simpowersdr simid5100 simft736 simftdx5000 simtmd700 simrotorez simspid simft817 simts590 simft847 simic7300 simic7000 simic7100 simic7200 simatd578 simic905 simts450 simic7600 simic7610 simic705 simts950 simts990 simic7851 simftdx101 simxiegug90 simqrplabs simft818 simic275 simtrusdx simft1000 simtmd710 simts890 simxiegux108g simxiegux6100 simic910 simft450 simelecraftk4 simmicom
simelecraft_SOURCES = simelecraft.c
simkenwood_SOURCES = simkenwood.c

Wyświetl plik

@ -0,0 +1,130 @@
// can run this using rigctl/rigctld and socat pty devices
// gcc -o simspid simspid.c
#define _XOPEN_SOURCE 700
// since we are POSIX here we need this
#if 0
struct ip_mreq
{
int dummy;
};
#endif
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include "../include/hamlib/rig.h"
#define BUFSIZE 256
float freqA = 14074000;
float freqB = 14074500;
char tx_vfo = '0';
char rx_vfo = '0';
char modeA = '1';
char modeB = '1';
int width_main = 500;
int width_sub = 700;
int
getmyline(int fd, unsigned char *buf)
{
int i = 0;
int n = 0;
memset(buf, 0, BUFSIZE);
n = read(fd, buf, 4);
if (n <= 0) { sleep(1); return 0;}
int bytesToRead = buf[1] + 2; //; len does not include cksum, or eom
n += read(fd, &buf[4], bytesToRead);
printf("n=%d:", n);
for (i = 0; i < n; ++i)
{
printf(" %02x", buf[i]);
}
printf("\n");
return n;
}
#if defined(WIN32) || defined(_WIN32)
int openPort(char *comport) // doesn't matter for using pts devices
{
int fd;
fd = open(comport, O_RDWR);
if (fd < 0)
{
perror(comport);
}
return fd;
}
#else
int openPort(char *comport) // doesn't matter for using pts devices
{
int fd = posix_openpt(O_RDWR);
char *name = ptsname(fd);
if (name == NULL)
{
perror("pstname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
int main(int argc, char *argv[])
{
unsigned char buf[256];
again:
int fd = openPort(argv[1]);
while (1)
{
int bytes = getmyline(fd, buf);
if (bytes == 0)
{
close(fd);
goto again;
}
switch (buf[3])
{
case 0x06:
printf("Report receiver freq\n");
break;
case 0x13:
printf("PTT On\n");
break;
case 0x14:
printf("PTT Off\n");
break;
default: printf("Unknown cmd=%02x\n", buf[3]);
}
}
return 0;
}