pull/1835/head
Nate Bargmann 2025-08-07 07:26:47 -05:00
commit 93a24356e5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: FB2C5130D55A8819
63 zmienionych plików z 574 dodań i 4037 usunięć

4
c++/.gitignore vendored 100644
Wyświetl plik

@ -0,0 +1,4 @@
test-suite.log
testcpp
testcpp.log
testcpp.trs

58
simulators/.gitignore vendored 100644
Wyświetl plik

@ -0,0 +1,58 @@
simatd578
simeasycomm
simelecraft
simelecraftk4
simflex
simft1000
simft450
simft710
simft736
simft817
simft818
simft847
simft990
simft991
simftdx101
simftdx1200
simftdx3000
simftdx5000
simic2730
simic275
simic7000
simic705
simic7100
simic7200
simic7300
simic7600
simic7610
simic7700
simic7851
simic905
simic910
simic9100
simic9700
simicgeneric
simicr8600
simid5100
simjupiter
simkenwood
simmicom
simorion
simpmr171
simpowersdr
simpstrotator
simqrplabs
simrotorez
simspid
simtmd700
simtmd710
simtrusdx
simts450
simts590
simts890
simts950
simts990
simxiegug90
simxiegux108g
simxiegux6100
simyaesu

Wyświetl plik

@ -1,5 +1,41 @@
#include "../src/misc.h"
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include "../src/misc.h"
/* ID 0310 == 310, Must drop leading zero */
typedef enum nc_rigid_e
{
NC_RIGID_NONE = 0,
NC_RIGID_FT450 = 241,
NC_RIGID_FT450D = 244,
NC_RIGID_FT950 = 310,
NC_RIGID_FT891 = 135,
NC_RIGID_FT991 = 570,
NC_RIGID_FT991A = 670,
NC_RIGID_FT2000 = 251,
NC_RIGID_FT2000D = 252,
NC_RIGID_FTDX1200 = 583,
NC_RIGID_FTDX10 = 761,
NC_RIGID_FTDX9000D = 101,
NC_RIGID_FTDX9000Contest = 102,
NC_RIGID_FTDX9000MP = 103,
NC_RIGID_FTDX5000 = 362,
NC_RIGID_FTDX3000 = 460,
NC_RIGID_FTDX3000DM = 462, // an undocumented FT-DX3000DM 50W rig
NC_RIGID_FTDX101D = 681,
NC_RIGID_FTDX101MP = 682,
NC_RIGID_FT710 = 800,
NC_RIGID_FTX1 = 840,
} nc_rigid_t;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
#define WRITE(f,b,l) write_sim(f,(const unsigned char*)b,l,__func__,__LINE__)
@ -18,3 +54,87 @@ int write_sim(int fd, const unsigned char *buf, int buflen, const char *func,
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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
// Size of command buffer
#define BUFSIZE 256
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return i; }
}
if (i == 0) { hl_usleep(10 * 1000); }
return i;
}
int
getmyline5(int fd, unsigned char *buf)
{
unsigned char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (i < 5 && read(fd, &c, 1) > 0)
{
buf[i++] = c;
}
if (i > 0) {
printf("n=%d %02x %02x %02x %02x %02x\n", i,
buf[0], buf[1], buf[2], buf[3], buf[4]);
}
if (i == 0) {
hl_usleep(10 * 1000);
}
return i;
}

Wyświetl plik

@ -1,19 +1,11 @@
// can run this using rigctl/rigctld and socat pty devices
#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"
#include "sim.h"
#define BUFSIZE 256
@ -30,7 +22,7 @@ int curr_vfo = 0;
int
getmyline(int fd, unsigned char *buf)
_getmyline(int fd, unsigned char *buf)
{
unsigned char c;
int i = 0;
@ -46,75 +38,31 @@ getmyline(int fd, unsigned char *buf)
{
buf[i++] = c;
}
n++;
}
while (c != 0x0a);
printf("n=%d \n", n);
for (i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("n=%d", i);
for (n = 0; n < i; ++n) { printf(" %02x", buf[n]); }
printf("\n");
return n;
return i;
}
#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("ptsname");
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], buf2[256];
int n;
unsigned char buf[BUFSIZE], buf2[256];
again:
int fd = openPort(argv[1]);
while (1)
{
int bytes = getmyline(fd, buf);
int bytes = _getmyline(fd, buf);
int n = 0;
if (bytes == 0)
{
close(fd);
goto again;
continue;
}
if (bytes != 8)

Wyświetl plik

@ -1,26 +1,20 @@
// can run this using rigctl/rigctld and socat pty devices
#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"
#include <pthread.h>
#include "hamlib/rig.h"
#include "misc.h"
#define BUFSIZE 256
static void *rotorez_thread(void *arg);
int
getmyline(int fd, char *buf)
_getmyline(int fd, char *buf)
{
unsigned char c = 0;
int i = 0;
@ -44,43 +38,7 @@ getmyline(int fd, char *buf)
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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int thread_args[2];
@ -103,8 +61,8 @@ int main(int argc, char *argv[])
while (1)
{
int bytes;
if (!flag) bytes = getmyline(fd, buf);
else bytes = getmyline(fd2, buf);
if (!flag) bytes = _getmyline(fd, buf);
else bytes = _getmyline(fd2, buf);
flag = !flag;
if (bytes == 0)
@ -149,23 +107,20 @@ int main(int argc, char *argv[])
static void *rotorez_thread(void *arg)
{
int n = 0;
char buf[256];
char buf[BUFSIZE];
int fd = *(int *)arg;
float az = 123;
float el = 45;
again:
while (1)
{
int bytes;
bytes = getmyline(fd, buf);
bytes = _getmyline(fd, buf);
if (bytes == 0)
{
//close(fd);
hl_usleep(100 * 1000);
//printf("again\n");
goto again;
continue;
}
printf("line[%d]=%s\n", fd, buf);

Wyświetl plik

@ -1,22 +1,15 @@
// can run this using rigctl/rigctld and socat pty devices
#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 "hamlib/rig.h"
#include "sim.h"
#include "misc.h"
#define BUFSIZE 256
float freqA = 14074000;
float freqB = 14074500;
@ -38,68 +31,12 @@ int modea = 2;
int modeb = 2;
int ptt = 0;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
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[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int n;
int fd = openPort(argv[1]);

Wyświetl plik

@ -1,22 +1,14 @@
// can run this using rigctl/rigctld and socat pty devices
#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 "hamlib/rig.h"
#include "sim.h"
#include "misc.h"
#define BUFSIZE 256
int freqA = 14074000;
int freqB = 14074500;
@ -39,68 +31,12 @@ int modeB = 2;
int ptt = 0;
// int freqa = 14074000, freqb = 14073500;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
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[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int n;
int fd = openPort(argv[1]);

Wyświetl plik

@ -2,6 +2,8 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/socket.h>
#if defined(WIN32) || defined(_WIN32)
#include <winsock2.h>
#include <ws2tcpip.h>

Wyświetl plik

@ -1,21 +1,11 @@
// can run this using rigctl/rigctld and socat pty devices
#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
#include "sim.h"
float freqA = 14074000;
float freqB = 14074500;
@ -27,80 +17,19 @@ int width_main = 500;
int width_sub = 700;
int
getmyline(int fd, unsigned char *buf)
{
unsigned char c;
int i = 0;
int n = 0;
memset(buf, 0, BUFSIZE);
while (i < 5 && read(fd, &c, 1) > 0)
{
buf[i++] = c;
n++;
}
printf("n=%d %02x %02x %02x %02x %02x\n", n, buf[0], buf[1], buf[2], buf[3],
buf[4]);
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("ptsname");
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];
unsigned char buf[BUFSIZE];
again:
int fd = openPort(argv[1]);
while (1)
{
int bytes = getmyline(fd, buf);
int bytes = getmyline5(fd, buf);
if (bytes == 0)
{
close(fd);
goto again;
continue;
}
if (bytes != 5)

Wyświetl plik

@ -1,21 +1,13 @@
// can run this using rigctl/rigctld and socat pty devices
#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
#include "hamlib/rig.h"
#include "misc.h"
float freqA = 14074000;
float freqB = 14074500;
@ -52,89 +44,13 @@ int gt = 0;
int ex016 = 0;
int ex020 = 0;
// ID 0310 == 310, Must drop leading zero
typedef enum nc_rigid_e
{
NC_RIGID_NONE = 0,
NC_RIGID_FT450 = 241,
NC_RIGID_FT450D = 244,
NC_RIGID_FT950 = 310,
NC_RIGID_FT891 = 135,
NC_RIGID_FT991 = 135,
NC_RIGID_FT2000 = 251,
NC_RIGID_FT2000D = 252,
NC_RIGID_FTDX1200 = 583,
NC_RIGID_FTDX9000D = 101,
NC_RIGID_FTDX9000Contest = 102,
NC_RIGID_FTDX9000MP = 103,
NC_RIGID_FTDX5000 = 362,
NC_RIGID_FTDX3000 = 460,
NC_RIGID_FTDX101D = 681,
NC_RIGID_FTDX101MP = 682
} nc_rigid_t;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int n;
int fd = openPort(argv[1]);

Wyświetl plik

@ -1,21 +1,13 @@
// can run this using rigctl/rigctld and socat pty devices
#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
#include "hamlib/rig.h"
#include "misc.h"
float freqA = 14074000;
float freqB = 14074500;
@ -53,90 +45,13 @@ int ex016 = 0;
int ex020 = 0;
int st = 0;
// ID 0310 == 310, Must drop leading zero
typedef enum nc_rigid_e
{
NC_RIGID_NONE = 0,
NC_RIGID_FT450 = 241,
NC_RIGID_FT450D = 244,
NC_RIGID_FT950 = 310,
NC_RIGID_FT891 = 135,
NC_RIGID_FT991 = 135,
NC_RIGID_FT2000 = 251,
NC_RIGID_FT2000D = 252,
NC_RIGID_FTDX1200 = 583,
NC_RIGID_FTDX9000D = 101,
NC_RIGID_FTDX9000Contest = 102,
NC_RIGID_FTDX9000MP = 103,
NC_RIGID_FTDX5000 = 362,
NC_RIGID_FTDX3000 = 460,
NC_RIGID_FTDX101D = 681,
NC_RIGID_FTDX101MP = 682,
NC_RIGID_FT710 = 800
} nc_rigid_t;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int n;
int fd = openPort(argv[1]);

Wyświetl plik

@ -1,21 +1,11 @@
// can run this using rigctl/rigctld and socat pty devices
#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
#include "sim.h"
float freqA = 14074000;
float freqB = 14074500;
@ -27,80 +17,19 @@ int width_main = 500;
int width_sub = 700;
int
getmyline(int fd, unsigned char *buf)
{
unsigned char c;
int i = 0;
int n = 0;
memset(buf, 0, BUFSIZE);
while (i < 5 && read(fd, &c, 1) > 0)
{
buf[i++] = c;
n++;
}
printf("n=%d %02x %02x %02x %02x %02x\n", n, buf[0], buf[1], buf[2], buf[3],
buf[4]);
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("ptsname");
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];
unsigned char buf[BUFSIZE];
again:
int fd = openPort(argv[1]);
while (1)
{
int bytes = getmyline(fd, buf);
int bytes = getmyline5(fd, buf);
if (bytes == 0)
{
close(fd);
goto again;
continue;
}
if (bytes != 5)

Wyświetl plik

@ -1,20 +1,13 @@
// can run this using rigctl/rigctld and socat pty devices
#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>
#define BUFSIZE 256
#include "sim.h"
float freqA = 14074000;
float freqB = 14074500;
@ -26,80 +19,19 @@ int width_main = 500;
int width_sub = 700;
int
getmyline(int fd, unsigned char *buf)
{
unsigned char c;
int i = 0;
int n = 0;
memset(buf, 0, BUFSIZE);
while (i < 5 && read(fd, &c, 1) > 0)
{
buf[i++] = c;
n++;
}
printf("n=%d %02x %02x %02x %02x %02x\n", n, buf[0], buf[1], buf[2], buf[3],
buf[4]);
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("ptsname");
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];
unsigned char buf[BUFSIZE];
again:
int fd = openPort(argv[1]);
while (1)
{
int bytes = getmyline(fd, buf);
int bytes = getmyline5(fd, buf);
if (bytes == 0)
{
close(fd);
goto again;
continue;
}
if (bytes != 5)

Wyświetl plik

@ -1,21 +1,11 @@
// can run this using rigctl/rigctld and socat pty devices
#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
#include "sim.h"
int vfo = 0; // 0=A, !0=B
float freqA = 14074000;
@ -28,80 +18,19 @@ int width_main = 500;
int width_sub = 700;
int
getmyline(int fd, unsigned char *buf)
{
unsigned char c;
int i = 0;
int n = 0;
memset(buf, 0, BUFSIZE);
while (i < 5 && read(fd, &c, 1) > 0)
{
buf[i++] = c;
n++;
}
printf("n=%d %02x %02x %02x %02x %02x\n", n, buf[0], buf[1], buf[2], buf[3],
buf[4]);
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("ptsname");
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];
unsigned char buf[BUFSIZE];
again:
int fd = openPort(argv[1]);
while (1)
{
int bytes = getmyline(fd, buf);
int bytes = getmyline5(fd, buf);
if (bytes == 0)
{
close(fd);
goto again;
continue;
}
if (bytes != 5)

Wyświetl plik

@ -1,21 +1,14 @@
// can run this using rigctl/rigctld and socat pty devices
#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 "hamlib/rig.h"
#define BUFSIZE 256
#include "hamlib/rig.h"
#include "misc.h"
float freqA = 14074000;
float freqB = 14074500;
@ -27,90 +20,13 @@ char modeB = '1';
int width = 0;
int ptt;
// ID 0310 == 310, Must drop leading zero
typedef enum nc_rigid_e
{
NC_RIGID_NONE = 0,
NC_RIGID_FT450 = 241,
NC_RIGID_FT450D = 244,
NC_RIGID_FT950 = 310,
NC_RIGID_FT891 = 135,
NC_RIGID_FT991 = 135,
NC_RIGID_FT2000 = 251,
NC_RIGID_FT2000D = 252,
NC_RIGID_FTDX1200 = 583,
NC_RIGID_FTDX9000D = 101,
NC_RIGID_FTDX9000Contest = 102,
NC_RIGID_FTDX9000MP = 103,
NC_RIGID_FTDX5000 = 362,
NC_RIGID_FTDX3000 = 460,
NC_RIGID_FTDX3000DM = 462,
NC_RIGID_FTDX101D = 681,
NC_RIGID_FTDX101MP = 682
} nc_rigid_t;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char resp[256];
char *pbuf;
int n;

Wyświetl plik

@ -1,21 +1,12 @@
// can run this using rigctl/rigctld and socat pty devices
#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"
//#include "hamlib/rig.h"
#define BUFSIZE 256
#include "sim.h"
/* In hono(u)r of the 10Hz resolution of the FT-847, vfo frequencies
* are stored in decaHertz(daHz)
@ -28,82 +19,20 @@ int width_sub = 700;
int vfo;
int
getmyline(int fd, unsigned char *buf)
{
unsigned char c;
int i = 0;
int n = 0;
memset(buf, 0, BUFSIZE);
while (i < 5 && read(fd, &c, 1) > 0)
{
buf[i++] = c;
n++;
}
printf("n=%d %02x %02x %02x %02x %02x\n", n, buf[0], buf[1], buf[2], buf[3],
buf[4]);
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("ptsname");
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];
unsigned char buf[BUFSIZE];
int freq, i, n;
again:
int fd = openPort(argv[1]);
while (1)
{
int bytes = getmyline(fd, buf);
int bytes = getmyline5(fd, buf);
if (bytes == 0)
{
close(fd);
goto again;
continue;
}
if (bytes != 5)

Wyświetl plik

@ -1,21 +1,14 @@
// can run this using rigctl/rigctld and socat pty devices
#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"
#include "hamlib/rig.h"
#define BUFSIZE 256
#include "sim.h"
float freqA = 14074000;
float freqB = 14074500;
@ -27,82 +20,20 @@ int width_main = 500;
int width_sub = 700;
int
getmyline(int fd, unsigned char *buf)
{
unsigned char c;
int i = 0;
int n = 0;
memset(buf, 0, BUFSIZE);
while (i < 5 && read(fd, &c, 1) > 0)
{
buf[i++] = c;
n++;
}
printf("n=%d %02x %02x %02x %02x %02x\n", n, buf[0], buf[1], buf[2], buf[3],
buf[4]);
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("ptsname");
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];
unsigned char buf[BUFSIZE];
int n;
again:
int fd = openPort(argv[1]);
while (1)
{
int bytes = getmyline(fd, buf);
int bytes = getmyline5(fd, buf);
if (bytes == 0)
{
close(fd);
goto again;
continue;
}
if (bytes != 5)

Wyświetl plik

@ -2,21 +2,12 @@
// emulates 1.2 ROM FT990 which can only read 1492 bytes
#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
#include "sim.h"
float freqA = 14074000;
float freqB = 14074500;
@ -27,29 +18,9 @@ char modeB = '1';
int width_main = 500;
int width_sub = 700;
#define ALL_DATA_SIZE 1492
// ID 0310 == 310, Must drop leading zero
typedef enum nc_rigid_e
{
NC_RIGID_NONE = 0,
NC_RIGID_FT450 = 241,
NC_RIGID_FT450D = 244,
NC_RIGID_FT950 = 310,
NC_RIGID_FT891 = 135,
NC_RIGID_FT991 = 135,
NC_RIGID_FT2000 = 251,
NC_RIGID_FT2000D = 252,
NC_RIGID_FTDX1200 = 583,
NC_RIGID_FTDX9000D = 101,
NC_RIGID_FTDX9000Contest = 102,
NC_RIGID_FTDX9000MP = 103,
NC_RIGID_FTDX5000 = 362,
NC_RIGID_FTDX3000 = 460,
NC_RIGID_FTDX101D = 681,
NC_RIGID_FTDX101MP = 682
} nc_rigid_t;
static void load_dat(const char *filename, unsigned char buf[1492])
static void load_dat(const char *filename, unsigned char buf[ALL_DATA_SIZE])
{
FILE *fp = fopen(filename, "r");
char line[4096];
@ -66,7 +37,7 @@ static void load_dat(const char *filename, unsigned char buf[1492])
sscanf(p, "%x", &val);
buf[n++] = val;
}
while (p = strtok(NULL, " \r\n"));
while ((p = strtok(NULL, " \r\n")));
strtok(s, "\r\n");
//printf("n=%d, %s\n",n,s);
@ -74,96 +45,35 @@ static void load_dat(const char *filename, unsigned char buf[1492])
}
fclose(fp);
printf("%d bytes read\n", n);
printf("%d bytes read from file %s\n", n, filename);
}
static unsigned char alldata[1492];
int
getmyline(int fd, char *buf)
{
unsigned char c;
int i = 0;
int n = 0;
memset(buf, 0, BUFSIZE);
#if 1
while (i < 5 && read(fd, &c, 1) > 0)
{
buf[i++] = c;
n++;
}
#else
n = read(fd, buf, 5);
#endif
printf("n=%d %02x %02x %02x %02x %02x\n", n, buf[0], buf[1], buf[2], buf[3],
buf[4]);
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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
static unsigned char alldata[ALL_DATA_SIZE];
int main(int argc, char *argv[])
{
char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
load_dat("simft990.dat", alldata);
while (1)
{
int bytes = getmyline(fd, buf);
int bytes = getmyline5(fd, buf);
if (bytes == 0) { continue; }
if (bytes != 5)
{
printf("Not 5 bytes? bytes=%d\n", bytes);
continue;
}
// Protocol of rigs/yaesu/ft990v12.c
if (buf[4] == 0x10)
{
write(fd, alldata, 1492);
write(fd, alldata, ALL_DATA_SIZE);
}
}

Wyświetl plik

@ -1,21 +1,13 @@
// can run this using rigctl/rigctld and socat pty devices
#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
#include "hamlib/rig.h"
#include "misc.h"
float freqA = 14074000;
float freqB = 14074500;
@ -31,89 +23,13 @@ int vd = 0;
int sm0 = 0;
int sm1 = 0;
// ID 0310 == 310, Must drop leading zero
typedef enum nc_rigid_e
{
NC_RIGID_NONE = 0,
NC_RIGID_FT450 = 241,
NC_RIGID_FT450D = 244,
NC_RIGID_FT950 = 310,
NC_RIGID_FT891 = 135,
NC_RIGID_FT991 = 135,
NC_RIGID_FT2000 = 251,
NC_RIGID_FT2000D = 252,
NC_RIGID_FTDX1200 = 583,
NC_RIGID_FTDX9000D = 101,
NC_RIGID_FTDX9000Contest = 102,
NC_RIGID_FTDX9000MP = 103,
NC_RIGID_FTDX5000 = 362,
NC_RIGID_FTDX3000 = 460,
NC_RIGID_FTDX101D = 681,
NC_RIGID_FTDX101MP = 682
} nc_rigid_t;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int n;
int fd = openPort(argv[1]);

Wyświetl plik

@ -1,21 +1,13 @@
// can run this using rigctl/rigctld and socat pty devices
#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
#include "hamlib/rig.h"
#include "misc.h"
float freqA = 14074000;
float freqB = 14074500;
@ -39,89 +31,13 @@ int rport_gain_psk = 50;
int syncvfo = 0;
int ant = 1;
// ID 0310 == 310, Must drop leading zero
typedef enum nc_rigid_e
{
NC_RIGID_NONE = 0,
NC_RIGID_FT450 = 241,
NC_RIGID_FT450D = 244,
NC_RIGID_FT950 = 310,
NC_RIGID_FT891 = 135,
NC_RIGID_FT991 = 135,
NC_RIGID_FT2000 = 251,
NC_RIGID_FT2000D = 252,
NC_RIGID_FTDX1200 = 583,
NC_RIGID_FTDX9000D = 101,
NC_RIGID_FTDX9000Contest = 102,
NC_RIGID_FTDX9000MP = 103,
NC_RIGID_FTDX5000 = 362,
NC_RIGID_FTDX3000 = 460,
NC_RIGID_FTDX101D = 681,
NC_RIGID_FTDX101MP = 682
} nc_rigid_t;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int n;
int fd = openPort(argv[1]);

Wyświetl plik

@ -1,21 +1,13 @@
// can run this using rigctl/rigctld and socat pty devices
#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
#include "hamlib/rig.h"
#include "misc.h"
float freqA = 14074000;
float freqB = 14074500;
@ -30,89 +22,13 @@ int na = 0;
int ex039 = 0;
int keyspd = 20;
// ID 0310 == 310, Must drop leading zero
typedef enum nc_rigid_e
{
NC_RIGID_NONE = 0,
NC_RIGID_FT450 = 241,
NC_RIGID_FT450D = 244,
NC_RIGID_FT950 = 310,
NC_RIGID_FT891 = 135,
NC_RIGID_FT991 = 135,
NC_RIGID_FT2000 = 251,
NC_RIGID_FT2000D = 252,
NC_RIGID_FTDX1200 = 583,
NC_RIGID_FTDX9000D = 101,
NC_RIGID_FTDX9000Contest = 102,
NC_RIGID_FTDX9000MP = 103,
NC_RIGID_FTDX5000 = 362,
NC_RIGID_FTDX3000 = 460,
NC_RIGID_FTDX101D = 681,
NC_RIGID_FTDX101MP = 682
} nc_rigid_t;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int n;
int fd = openPort(argv[1]);

Wyświetl plik

@ -1,21 +1,13 @@
// can run this using rigctl/rigctld and socat pty devices
#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
#include "hamlib/rig.h"
#include "misc.h"
float freqA = 14074000;
float freqB = 14074500;
@ -29,89 +21,13 @@ int sh = 25;
int na = 0;
int ex039 = 0;
// ID 0310 == 310, Must drop leading zero
typedef enum nc_rigid_e
{
NC_RIGID_NONE = 0,
NC_RIGID_FT450 = 241,
NC_RIGID_FT450D = 244,
NC_RIGID_FT950 = 310,
NC_RIGID_FT891 = 135,
NC_RIGID_FT991 = 135,
NC_RIGID_FT2000 = 251,
NC_RIGID_FT2000D = 252,
NC_RIGID_FTDX1200 = 583,
NC_RIGID_FTDX9000D = 101,
NC_RIGID_FTDX9000Contest = 102,
NC_RIGID_FTDX9000MP = 103,
NC_RIGID_FTDX5000 = 362,
NC_RIGID_FTDX3000 = 460,
NC_RIGID_FTDX101D = 681,
NC_RIGID_FTDX101MP = 682
} nc_rigid_t;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int n;
int fd = openPort(argv[1]);

Wyświetl plik

@ -1,21 +1,13 @@
// can run this using rigctl/rigctld and socat pty devices
#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
#include "hamlib/rig.h"
#include "misc.h"
float freqA = 14074000;
float freqB = 14074500;
@ -31,89 +23,13 @@ int na = 0;
int ex039 = 0;
int ex103 = 0;
// ID 0310 == 310, Must drop leading zero
typedef enum nc_rigid_e
{
NC_RIGID_NONE = 0,
NC_RIGID_FT450 = 241,
NC_RIGID_FT450D = 244,
NC_RIGID_FT950 = 310,
NC_RIGID_FT891 = 135,
NC_RIGID_FT991 = 135,
NC_RIGID_FT2000 = 251,
NC_RIGID_FT2000D = 252,
NC_RIGID_FTDX1200 = 583,
NC_RIGID_FTDX9000D = 101,
NC_RIGID_FTDX9000Contest = 102,
NC_RIGID_FTDX9000MP = 103,
NC_RIGID_FTDX5000 = 362,
NC_RIGID_FTDX3000 = 460,
NC_RIGID_FTDX101D = 681,
NC_RIGID_FTDX101MP = 682
} nc_rigid_t;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int n;
int fd = openPort(argv[1]);

Wyświetl plik

@ -3,27 +3,17 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -50,13 +40,6 @@ int transceive = 0;
int keyspd = 20;
int rigtime = 1230;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -64,8 +47,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -96,7 +77,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -515,43 +496,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
@ -569,7 +513,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,27 +3,17 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -50,13 +40,6 @@ int transceive = 0;
int keyspd = 20;
int rigtime = 1230;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -64,8 +47,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -96,7 +77,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -510,43 +491,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
@ -564,7 +508,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,27 +3,16 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -50,13 +39,6 @@ int transceive = 0;
int keyspd = 20;
int rigtime = 1230;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -64,8 +46,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -95,7 +75,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -528,44 +508,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
@ -582,7 +524,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,25 +3,14 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "hamlib/rig.h"
#include "misc.h"
#include "sim.h"
/* Simulators really shouldn't be using ANY of the definitions
* from the Hamlib rig.h parameters, but only those of the
* rig itself. This still won't be a clean room implementation,
@ -30,7 +19,6 @@ struct ip_mreq
*/
#include "../rigs/icom/icom_defs.h"
#define BUFSIZE 256
#define X25
#undef SATMODE
@ -59,13 +47,6 @@ int ovf_status = 0;
int powerstat = 1;
const char *vfonames[2] = {"VFOA", "VFOB"};
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -73,8 +54,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -98,7 +77,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -586,43 +565,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
@ -640,7 +582,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,28 +3,18 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#undef ECHO
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -49,13 +39,6 @@ int ovf_status = 0;
int powerstat = 1;
int keyspd = 20;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -63,8 +46,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -95,7 +76,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -474,44 +455,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
@ -528,7 +471,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,27 +3,17 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -60,13 +50,6 @@ int speechcompressor = 0;
int agc = 0;
int vox = 0;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -74,8 +57,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -108,7 +89,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -804,44 +785,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
@ -858,7 +801,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,27 +3,17 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -50,13 +40,6 @@ int ovf_status = 0;
int powerstat = 1;
int keyertype = 0;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -64,8 +47,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -95,7 +76,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -715,44 +696,6 @@ if (n == 0) { printf("Write failed=%s\n", strerror(errno)); }
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
@ -769,7 +712,7 @@ printf("%cVFOB: mode=%d datamode=%d width=%ld freq=%.0f\n", vfob, modeB,
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,27 +3,17 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
//#define X25
int civ_731_mode = 0;
@ -48,13 +38,6 @@ int ovf_status = 0;
int powerstat = 1;
int datamode = 0;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -62,8 +45,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -87,7 +68,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -626,44 +607,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
@ -680,7 +623,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -2,27 +2,16 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -52,13 +41,6 @@ int tx_inhibit = 0;
int dpp = 0;
int dualwatch = 0;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -66,8 +48,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -91,7 +71,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -732,44 +712,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
@ -786,7 +728,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,27 +3,17 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -51,13 +41,6 @@ int ovf_status = 0;
int powerstat = 1;
int keyertype = 0;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -65,8 +48,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -90,7 +71,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -693,43 +674,6 @@ if (n == 0) { printf("Write failed=%s\n", strerror(errno)); }
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
@ -747,7 +691,7 @@ printf("%cVFOB: mode=%d datamode=%d width=%ld freq=%.0f\n", vfob, modeB,
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -2,27 +2,17 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -54,13 +44,6 @@ int notch = 0;
int speechcompressor = 0;
int vox = 0;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -68,8 +51,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c = 0xff;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -94,7 +75,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -796,43 +777,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
@ -850,7 +794,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,28 +3,17 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -53,13 +42,6 @@ int keyspd = 25;
int datamode = 0;
int filter = 0;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -67,8 +49,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -92,7 +72,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -104,6 +84,7 @@ again:
void frameParse(int fd, unsigned char *frame, int len)
{
double freq;
int freq_len = 5;
if (len == 0)
{
@ -125,7 +106,6 @@ void frameParse(int fd, unsigned char *frame, int len)
case 0x03:
//from_bcd(frameackbuf[2], (civ_731_mode ? 4 : 5) * 2);
int freq_len = 5;
if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN)
{
@ -593,44 +573,6 @@ void frameParse(int fd, unsigned char *frame, int len)
// don't care about the rig type yet
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
@ -647,7 +589,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,28 +3,18 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
//#define X25
int civ_731_mode = 0;
@ -53,13 +43,6 @@ int keyspd = 25;
int datamode = 0;
int filter = 0;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -67,8 +50,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -92,7 +73,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -104,6 +85,7 @@ again:
void frameParse(int fd, unsigned char *frame, int len)
{
double freq;
int freq_len = 5;
if (len == 0)
{
@ -128,7 +110,6 @@ void frameParse(int fd, unsigned char *frame, int len)
case 0x03:
//from_bcd(frameackbuf[2], (civ_731_mode ? 4 : 5) * 2);
int freq_len = 5;
if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN)
{
@ -596,44 +577,6 @@ void frameParse(int fd, unsigned char *frame, int len)
// don't care about the rig type yet
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
@ -650,7 +593,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,27 +3,16 @@
// Needs a lot of improvement to work on all Icoms
#define _XOPEN_SOURCE 700
// since we are POSIX here we need this
#if 0
struct ip_mreq
{
int dummy;
};
#endif
#include "hamlib/rig.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/time.h>
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include "sim.h"
#define BUFSIZE 256
#include "hamlib/rig.h"
#include "sim.h"
#include "misc.h"
//#define X25
int civ_731_mode = 0;
@ -48,13 +37,6 @@ int ovf_status = 0;
int powerstat = 1;
int subband = 1;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -62,8 +44,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -87,7 +67,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -529,44 +509,6 @@ printf("+++++++++++++++ SETTING VFO +++++++++++++++++\n");
// don't care about the rig type yet
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
@ -583,7 +525,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,28 +3,17 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -50,13 +39,6 @@ int ovf_status = 0;
int powerstat = 1;
int keyspd = 90;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -64,8 +46,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -89,7 +69,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -558,44 +538,6 @@ void frameParse(int fd, unsigned char *frame, int len)
// don't care about the rig type yet
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
@ -612,7 +554,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,24 +3,16 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#include <errno.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
//#define X25
int civ_731_mode = 0;
@ -40,13 +32,6 @@ ant_t ant_curr = 0;
int ant_option = 0;
int ptt = 0;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -396,44 +381,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
@ -450,7 +397,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,24 +3,16 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#include <errno.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
//#define X25
int civ_731_mode = 0;
@ -40,13 +32,6 @@ ant_t ant_curr = 0;
int ant_option = 0;
int ptt = 0;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -391,44 +376,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
@ -445,7 +392,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,27 +3,17 @@
// Needs a lot of improvement to work on all Icoms
#define _XOPEN_SOURCE 700
// since we are POSIX here we need this
#if 0
struct ip_mreq
{
int dummy;
};
#endif
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/types.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <termios.h>
#include <unistd.h>
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
int civ_731_mode = 0;
vfo_t current_vfo = RIG_VFO_A;
@ -45,13 +35,6 @@ int agc_time = 1;
int ovf_status = 0;
int powerstat = 1;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -59,8 +42,6 @@ frameGet(int fd, unsigned char *buf)
memset(buf, 0, BUFSIZE);
unsigned char c;
again:
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
@ -84,7 +65,7 @@ again:
}
i = 0;
goto again;
continue;
}
}
@ -387,44 +368,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
@ -439,7 +382,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -1,21 +1,11 @@
// can run this using rigctl/rigctld and socat pty devices
#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
#include "sim.h"
float freqA = 14074000;
float freqB = 14074500;
@ -27,80 +17,19 @@ int width_main = 500;
int width_sub = 700;
int
getmyline(int fd, unsigned char *buf)
{
unsigned char c;
int i = 0;
int n = 0;
memset(buf, 0, BUFSIZE);
while (i < 5 && read(fd, &c, 1) > 0)
{
buf[i++] = c;
n++;
}
printf("n=%d %02x %02x %02x %02x %02x\n", n, buf[0], buf[1], buf[2], buf[3],
buf[4]);
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("ptsname");
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];
unsigned char buf[BUFSIZE];
again:
int fd = openPort(argv[1]);
while (1)
{
int bytes = getmyline(fd, buf);
int bytes = getmyline5(fd, buf);
if (bytes == 0)
{
close(fd);
goto again;
continue;
}
if (bytes != 5)

Wyświetl plik

@ -1,21 +1,13 @@
// can run this using rigctl/rigctld and socat pty devices
#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 "hamlib/rig.h"
#define BUFSIZE 256
#include "hamlib/rig.h"
#include "misc.h"
int mysleep = 20;
@ -25,68 +17,13 @@ int filternum = 7;
int datamode = 0;
int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int fd = openPort(argv[1]);
int freqa = 14074000, freqb = 140735000;

Wyświetl plik

@ -1,20 +1,11 @@
// can run this using rigctl/rigctld and socat pty devices
#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"
#include "../src/misc.h"
#include "misc.h"
#define BUFSIZE 256
@ -29,7 +20,7 @@ int width_sub = 700;
int
getmyline(int fd, unsigned char *buf)
_getmyline(int fd, unsigned char *buf)
{
int i = 0;
int n = 0;
@ -52,62 +43,22 @@ getmyline(int fd, unsigned char *buf)
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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
again:
int fd = openPort(argv[1]);
while (1)
{
int bytes = getmyline(fd, buf);
int bytes = _getmyline(fd, buf);
if (bytes == 0)
{
close(fd);
goto again;
continue;
}
switch (buf[3])

Wyświetl plik

@ -1,19 +1,9 @@
// can run this using rigctl/rigctld and socat pty devices
#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
@ -25,7 +15,7 @@ int ptt = 0;
int keyspd = 20;
int
getmyline(int fd, char *buf)
_getmyline(int fd, char *buf)
{
unsigned char c;
int i = 0;
@ -43,61 +33,22 @@ getmyline(int fd, char *buf)
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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256], reply[256];
char buf[BUFSIZE], reply[256];
again:
int fd = openPort(argv[1]);
while (1)
{
int bytes = getmyline(fd, buf);
int bytes = _getmyline(fd, buf);
if (bytes == 0)
{
close(fd);
goto again;
continue;
}
if (strncmp(buf, "?V", 2) == 0)

Wyświetl plik

@ -1,19 +1,9 @@
// can run this using rigctl/rigctld and socat pty devices
#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
@ -28,7 +18,7 @@ int width_sub = 700;
int
getmyline(int fd, unsigned char *buf)
_getmyline(int fd, unsigned char *buf)
{
unsigned char c;
int i = 0;
@ -59,61 +49,22 @@ getmyline(int fd, unsigned char *buf)
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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
again:
int fd = openPort(argv[1]);
while (1)
{
int bytes = getmyline(fd, buf);
int bytes = _getmyline(fd, buf);
if (bytes == 0)
{
close(fd);
goto again;
continue;
}
switch (buf[5])

Wyświetl plik

@ -1,21 +1,13 @@
// can run this using rigctl/rigctld and socat pty devices
#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 "hamlib/rig.h"
#define BUFSIZE 256
#include "hamlib/rig.h"
#include "misc.h"
float freqA = 14074000;
float freqB = 14074500;
@ -26,68 +18,13 @@ int keyspd = 20;
double alc = 0;
int tx;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int n;
int fd = openPort(argv[1]);

Wyświetl plik

@ -3,6 +3,9 @@
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#define SERVER_PORT 12001
#define REPLY_PORT 12002

Wyświetl plik

@ -1,21 +1,14 @@
// can run this using rigctl/rigctld and socat pty devices
#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 "hamlib/rig.h"
#include <sys/types.h>
#include "hamlib/rig.h"
#include "misc.h"
#define BUFSIZE 256
int mysleep = 20;
@ -26,68 +19,13 @@ int datamode = 0;
int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune;
int tomode = 0;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int fd = openPort(argv[1]);
int freqa = 14074000, freqb = 140735000;

Wyświetl plik

@ -1,26 +1,20 @@
// can run this using rigctl/rigctld and socat pty devices
#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"
#include <pthread.h>
#include "hamlib/rig.h"
#include "misc.h"
#define BUFSIZE 256
static void *rotorez_thread(void *arg);
int
getmyline(int fd, char *buf)
_getmyline(int fd, char *buf)
{
unsigned char c = 0;
int i = 0;
@ -44,43 +38,7 @@ getmyline(int fd, char *buf)
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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int thread_args[2];
@ -103,8 +61,8 @@ int main(int argc, char *argv[])
while (1)
{
int bytes;
if (!flag) bytes = getmyline(fd, buf);
else bytes = getmyline(fd2, buf);
if (!flag) bytes = _getmyline(fd, buf);
else bytes = _getmyline(fd2, buf);
flag = !flag;
if (bytes == 0)
@ -149,23 +107,20 @@ int main(int argc, char *argv[])
static void *rotorez_thread(void *arg)
{
int n = 0;
char buf[256];
char buf[BUFSIZE];
int fd = *(int *)arg;
float az = 123;
float el = 45;
again:
while (1)
{
int bytes;
bytes = getmyline(fd, buf);
bytes = _getmyline(fd, buf);
if (bytes == 0)
{
//close(fd);
hl_usleep(100 * 1000);
//printf("again\n");
goto again;
continue;
}
printf("line[%d]=%s\n", fd, buf);

Wyświetl plik

@ -1,21 +1,11 @@
// can run this using rigctl/rigctld and socat pty devices
#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
#include "sim.h"
float freqA = 14074000;
float freqB = 14074500;
@ -27,81 +17,19 @@ int width_main = 500;
int width_sub = 700;
int
getmyline(int fd, unsigned char *buf)
{
unsigned char c;
int i = 0;
int n = 0;
memset(buf, 0, BUFSIZE);
while (i < 5 && read(fd, &c, 1) > 0)
{
buf[i++] = c;
n++;
}
printf("n=%d %02x %02x %02x %02x %02x\n", n, buf[0], buf[1], buf[2], buf[3],
buf[4]);
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("ptsname");
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];
unsigned char buf[BUFSIZE];
again:
int fd = openPort(argv[1]);
while (1)
{
int bytes = getmyline(fd, buf);
int bytes = getmyline5(fd, buf);
if (bytes == 0)
{
close(fd);
goto again;
continue;
}
if (bytes != 5)

Wyświetl plik

@ -1,19 +1,12 @@
// can run this using rigctl/rigctld and socat pty devices
#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"
#include "hamlib/rig.h"
#include "misc.h"
#define BUFSIZE 256
double freqA = 147000000;
@ -26,7 +19,7 @@ int band = 0;
int control = 1;
int
getmyline(int fd, char *buf)
_getmyline(int fd, char *buf)
{
char c;
int i = 0;
@ -44,55 +37,18 @@ getmyline(int fd, char *buf)
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
int n;
int fd = openPort(argv[1]);
while (1)
{
if (getmyline(fd, buf))
if (_getmyline(fd, buf))
{
printf("Cmd:%s\n", buf);
}

Wyświetl plik

@ -1,18 +1,10 @@
// can run this using rigctl/rigctld and socat pty devices
#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 "hamlib/rig.h"
#define BUFSIZE 256
@ -26,7 +18,7 @@ int datamode = 0;
int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune;
int
getmyline(int fd, char *buf)
_getmyline(int fd, char *buf)
{
char c;
int i = 0;
@ -44,74 +36,42 @@ getmyline(int fd, char *buf)
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
int fd = openPort(argv[1]);
while (1)
{
buf[0] = 0;
if (getmyline(fd, buf) > 0) { printf("Cmd:%s\n", buf); }
if (_getmyline(fd, buf) > 0) { printf("Cmd:%s\n", buf); }
if (strncmp(buf, "BC", 2) == 0)
{
SNPRINTF(buf, sizeof(buf), "BC %d %d%c", vfo, vfo_tx, 0x0d);
SNPRINTF(buf, sizeof(buf), "BC %d,%d%c", vfo, vfo_tx, 0x0d);
printf("R:%s\n", buf);
write(fd, buf, strlen(buf));
continue;
}
else if (strncmp(buf, "FO", 2) == 0)
{
if (buf[3] == '0')
{
SNPRINTF(buf, sizeof(buf), "FO 0 %d%c", freqA, 0x0d);
}
else
{
SNPRINTF(buf, sizeof(buf), "FO 1 %d%c", freqB, 0x0d);
char vfo = buf[3];
int frequency;
char tone_frequency[] = "10"; // 94.8
char ctcss_frequency[] = "05"; // 79,7
char dcs_frequency[] = "016"; // 114
if (vfo == '0') {
frequency = (int)freqA;
} else {
frequency = (int)freqB;
}
SNPRINTF(buf, sizeof(buf), "FO %c,%.10d,0,0,0,0,0,0,%.2s,%.2s,%.3s,00000000,0%c",
vfo, frequency, tone_frequency, ctcss_frequency, dcs_frequency, 0x0d);
printf("R:%s\n", buf);
write(fd, buf, strlen(buf));

Wyświetl plik

@ -1,22 +1,14 @@
// can run this using rigctl/rigctld and socat pty devices
#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 "hamlib/rig.h"
#include "sim.h"
#include <sys/types.h>
#include "hamlib/rig.h"
#include "misc.h"
#define BUFSIZE 256
int mysleep = 20;
@ -28,68 +20,13 @@ int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune;
int tomode = 0;
int keyspd = 25;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int fd = openPort(argv[1]);
int freqa = 14074000, freqb = 140735000;

Wyświetl plik

@ -1,22 +1,14 @@
// can run this using rigctl/rigctld and socat pty devices
#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 "hamlib/rig.h"
#include "sim.h"
#include <sys/types.h>
#include "hamlib/rig.h"
#include "misc.h"
#define BUFSIZE 256
int mysleep = 20;
@ -28,68 +20,13 @@ int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune;
int tomode = 0;
int keyspd = 25;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int fd = openPort(argv[1]);
int freqa = 14074000, freqb = 140735000;

Wyświetl plik

@ -1,22 +1,15 @@
// can run this using rigctl/rigctld and socat pty devices
#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 <sys/types.h>
#include "hamlib/rig.h"
#include "sim.h"
#include "misc.h"
#define BUFSIZE 256
int mysleep = 20;
@ -34,7 +27,7 @@ int usb_af_input = 9;
int mic_gain = 50;
int
getmyline(int fd, char *buf)
_getmyline(int fd, char *buf)
{
char c;
int i = 0;
@ -54,49 +47,11 @@ getmyline(int fd, char *buf)
return strlen(buf);
}
#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("ptsname");
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[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int fd = openPort(argv[1]);
int freqa = 14074000, freqb = 140735000;
@ -106,7 +61,7 @@ int main(int argc, char *argv[])
{
buf[0] = 0;
if (getmyline(fd, buf) > 0) { printf("Cmd:%s\n", buf); }
if (_getmyline(fd, buf) > 0) { printf("Cmd:%s\n", buf); }
// else { return 0; }

Wyświetl plik

@ -27,22 +27,14 @@
// can run this using rigctl/rigctld and socat pty devices
#define _XOPEN_SOURCE 700
// since we are POSIX here we need this
#if 0
struct ip_mreq
{
int dummy;
};
#endif
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <time.h>
#include "config.h"
//#include "hamlib/rig.h"
/* Definitions */
@ -52,8 +44,6 @@ struct ip_mreq
* app is only using the latest-and-greatest, comment out the next define.
*/
#define LEGACY
// Size of command buffer
#define BUFSIZE 256
// Number of selectable bands
#define NBANDS 11
/* Type we're emulating - K=The Americas(default), E=Europe */
@ -211,74 +201,12 @@ static void swapvfos(kvfop_t *vfoset[]);
// Extracted from rig.h
int hl_usleep(unsigned long usec); // Until it's replaced
#if defined(WIN32) || defined(_WIN32)
int openPort(char *comport) // doesn't matter for using pts devices
{
int fd;
fd = open(comport, O_RDWR);
#include "sim.h"
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("ptsname");
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
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
int retval;
while ((retval = read(fd, &c, 1)) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (retval != 0)
{
perror("read failed:");
//close(fd);
//fd = openPort("");
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int fd = openPort(argv[1]);
int cmd_err = 0;

Wyświetl plik

@ -1,21 +1,14 @@
// can run this using rigctl/rigctld and socat pty devices
#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 "hamlib/rig.h"
#include <sys/types.h>
#include "hamlib/rig.h"
#include "misc.h"
#define BUFSIZE 256
int mysleep = 20;
@ -26,68 +19,13 @@ int filternum2 = 8;
int datamode = 0;
int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int fd = openPort(argv[1]);
int freqa = 14074000, freqb = 140735000;

Wyświetl plik

@ -1,22 +1,14 @@
// can run this using rigctl/rigctld and socat pty devices
#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 <errno.h>
#include "hamlib/rig.h"
#include <sys/types.h>
#include "hamlib/rig.h"
#include "misc.h"
#define BUFSIZE 256
int mysleep = 20;
@ -60,76 +52,14 @@ int mo1 = 0;
int pc = 50;
#if defined(WIN32) || defined(_WIN32)
int openPort(char *comport) // doesn't matter for using pts devices
{
int fd;
fd = open(comport, O_RDWR);
#include "sim.h"
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("ptsname");
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
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
int retval;
while ((retval = read(fd, &c, 1)) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (retval != 0)
{
perror("read failed:");
//close(fd);
//fd = openPort("");
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char *pbuf;
int fd = openPort(argv[1]);
char modeA = '1', modeB = '2';

Wyświetl plik

@ -3,23 +3,15 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <sys/types.h>
#include "hamlib/rig.h"
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -40,13 +32,6 @@ int ant_option = 0;
int ptt = 0;
int keyspd = 20;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -411,43 +396,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
@ -465,7 +413,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,23 +3,15 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <sys/types.h>
#include "hamlib/rig.h"
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -40,13 +32,6 @@ int ant_option = 0;
int ptt = 0;
int keyspd = 20;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -403,43 +388,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
@ -457,7 +405,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -3,23 +3,15 @@
// Needs a lot of improvement to work on all Icoms
#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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#include "hamlib/rig.h"
#include "../src/misc.h"
#include <sys/types.h>
#include "hamlib/rig.h"
#include "misc.h"
#include "sim.h"
#define BUFSIZE 256
#define X25
int civ_731_mode = 0;
@ -40,13 +32,6 @@ int ant_option = 0;
int ptt = 0;
int keyspd = 20;
void dumphex(const unsigned char *buf, int n)
{
for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); }
printf("\n");
}
int
frameGet(int fd, unsigned char *buf)
{
@ -416,43 +401,6 @@ void frameParse(int fd, unsigned char *frame, int len)
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
void rigStatus()
{
@ -470,7 +418,7 @@ void rigStatus()
int main(int argc, char **argv)
{
unsigned char buf[256];
unsigned char buf[BUFSIZE];
int fd = openPort(argv[1]);
printf("%s: %s\n", argv[0], rig_version());

Wyświetl plik

@ -1,21 +1,13 @@
// can run this using rigctl/rigctld and socat pty devices
#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 "hamlib/rig.h"
#define BUFSIZE 256
#include "hamlib/rig.h"
#include "misc.h"
float freqA = 14074000;
float freqB = 14074500;
@ -33,90 +25,13 @@ int width_sub = 0;
int ex039 = 0;
int lk = 0;
// ID 0310 == 310, Must drop leading zero
typedef enum nc_rigid_e
{
NC_RIGID_NONE = 0,
NC_RIGID_FT450 = 241,
NC_RIGID_FT450D = 244,
NC_RIGID_FT950 = 310,
NC_RIGID_FT891 = 135,
NC_RIGID_FT991 = 135,
NC_RIGID_FT2000 = 251,
NC_RIGID_FT2000D = 252,
NC_RIGID_FTDX1200 = 583,
NC_RIGID_FTDX9000D = 101,
NC_RIGID_FTDX9000Contest = 102,
NC_RIGID_FTDX9000MP = 103,
NC_RIGID_FTDX5000 = 362,
NC_RIGID_FTDX3000 = 460,
NC_RIGID_FTDX3000DM = 462,
NC_RIGID_FTDX101D = 681,
NC_RIGID_FTDX101MP = 682
} nc_rigid_t;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
}
#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("ptsname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
#include "sim.h"
int main(int argc, char *argv[])
{
char buf[256];
char buf[BUFSIZE];
char resp[256];
char *pbuf;
int n;
@ -138,6 +53,9 @@ int main(int argc, char *argv[])
if (power == 0 && strcmp(buf, "PS1;") != 0) { continue; }
resp[0] = 0;
pbuf = NULL;
if (strcmp(buf, "PS;") == 0)
{
sprintf(resp, "PS%d;", power);
@ -151,7 +69,6 @@ int main(int argc, char *argv[])
}
else if (strcmp(buf, "RM5;") == 0)
{
printf("%s\n", buf);
hl_usleep(50 * 1000);
pbuf = "RM5100000;";
n = write(fd, pbuf, strlen(pbuf));
@ -161,7 +78,6 @@ int main(int argc, char *argv[])
}
else if (strcmp(buf, "RM8;") == 0)
{
printf("%s\n", buf);
hl_usleep(50 * 1000);
pbuf = "RM8197000;";
n = write(fd, pbuf, strlen(pbuf));
@ -171,7 +87,6 @@ int main(int argc, char *argv[])
}
else if (strcmp(buf, "RM9;") == 0)
{
printf("%s\n", buf);
hl_usleep(50 * 1000);
pbuf = "RM9089000;";
n = write(fd, pbuf, strlen(pbuf));
@ -182,7 +97,6 @@ int main(int argc, char *argv[])
else if (strcmp(buf, "AN0;") == 0)
{
printf("%s\n", buf);
hl_usleep(50 * 1000);
pbuf = "AN030;";
n = write(fd, pbuf, strlen(pbuf));
@ -213,7 +127,6 @@ int main(int argc, char *argv[])
}
else if (strcmp(buf, "IF;") == 0)
{
printf("%s\n", buf);
hl_usleep(50 * 1000);
pbuf = "IF00107041000+000000200000;";
n = write(fd, pbuf, strlen(pbuf));
@ -223,21 +136,19 @@ int main(int argc, char *argv[])
}
else if (strcmp(buf, "ID;") == 0)
{
printf("%s\n", buf);
hl_usleep(50 * 1000);
int id = NC_RIGID_FT991;
SNPRINTF(buf, sizeof(buf), "ID%03d;", id);
n = write(fd, buf, strlen(buf));
SNPRINTF(resp, sizeof(resp), "ID%03d;", id);
n = write(fd, resp, strlen(resp));
//printf("n=%d\n", n);
if (n <= 0) { perror("ID"); }
}
else if (strcmp(buf, "AI;") == 0)
{
printf("%s\n", buf);
hl_usleep(50 * 1000);
SNPRINTF(buf, sizeof(buf), "AI0;");
n = write(fd, buf, strlen(buf));
SNPRINTF(resp, sizeof(resp), "AI0;");
n = write(fd, resp, strlen(resp));
//printf("n=%d\n", n);
if (n <= 0) { perror("AI"); }
@ -257,8 +168,7 @@ int main(int argc, char *argv[])
{
if (strcmp(buf, "AI;"))
{
printf("%s\n", buf);
hl_usleep(50 * 1000);
hl_usleep(50 * 1000);
n = fprintf(fp, "%s", "AI0;");
printf("n=%d\n", n);
@ -274,7 +184,6 @@ int main(int argc, char *argv[])
}
else if (strcmp(buf, "VS;") == 0)
{
printf("%s\n", buf);
hl_usleep(50 * 1000);
pbuf = "VS0;";
@ -352,51 +261,50 @@ int main(int argc, char *argv[])
{
static int ant = 0;
ant = (ant + 1) % 3;
printf("%s\n", buf);
hl_usleep(50 * 1000);
SNPRINTF(buf, sizeof(buf), "EX032%1d;", ant);
n = write(fd, buf, strlen(buf));
SNPRINTF(resp, sizeof(resp), "EX032%1d;", ant);
n = write(fd, resp, strlen(resp));
//printf("n=%d\n", n);
if (n < 0) { perror("EX032"); }
}
else if (strcmp(buf, "NA0;") == 0)
{
SNPRINTF(buf, sizeof(buf), "NA00;");
SNPRINTF(resp, sizeof(resp), "NA00;");
hl_usleep(50 * 1000);
n = write(fd, buf, strlen(buf));
//printf("%s n=%d\n", buf, n);
n = write(fd, resp, strlen(resp));
//printf("%s n=%d\n", resp, n);
}
else if (strcmp(buf, "RF0;") == 0)
{
SNPRINTF(buf, sizeof(buf), "RF0%d;", roofing_filter_main);
SNPRINTF(resp, sizeof(resp), "RF0%d;", roofing_filter_main);
hl_usleep(50 * 1000);
n = write(fd, buf, strlen(buf));
n = write(fd, resp, strlen(resp));
}
else if (strcmp(buf, "RF1;") == 0)
{
SNPRINTF(buf, sizeof(buf), "RF1%d;", roofing_filter_sub);
SNPRINTF(resp, sizeof(resp), "RF1%d;", roofing_filter_sub);
hl_usleep(50 * 1000);
n = write(fd, buf, strlen(buf));
n = write(fd, resp, strlen(resp));
}
else if (strncmp(buf, "RF", 2) == 0)
{
SNPRINTF(buf, sizeof(buf), "RF%c%d;", buf[2],
SNPRINTF(resp, sizeof(resp), "RF%c%d;", buf[2],
buf[2] == 0 ? roofing_filter_main : roofing_filter_sub);
hl_usleep(50 * 1000);
n = write(fd, buf, strlen(buf));
n = write(fd, resp, strlen(resp));
}
else if (strcmp(buf, "SH0;") == 0)
{
SNPRINTF(buf, sizeof(buf), "SH%c%02d;", buf[2], width_main);
SNPRINTF(resp, sizeof(resp), "SH%c%02d;", buf[2], width_main);
hl_usleep(50 * 1000);
n = write(fd, buf, strlen(buf));
n = write(fd, resp, strlen(resp));
}
else if (strcmp(buf, "SH1;") == 0)
{
SNPRINTF(buf, sizeof(buf), "SH%c%02d;", buf[2], width_sub);
SNPRINTF(resp, sizeof(resp), "SH%c%02d;", buf[2], width_sub);
hl_usleep(50 * 1000);
n = write(fd, buf, strlen(buf));
n = write(fd, resp, strlen(resp));
}
else if (strncmp(buf, "SH", 2) == 0 && strlen(buf) > 4)
{
@ -410,13 +318,13 @@ int main(int argc, char *argv[])
}
else if (strncmp(buf, "SH", 2) == 0)
{
SNPRINTF(buf, sizeof(buf), "SH%c%02d;", buf[2],
SNPRINTF(resp, sizeof(resp), "SH%c%02d;", buf[2],
buf[2] == 0 ? width_main : width_sub);
}
else if (strcmp(buf, "EX039;") == 0)
{
SNPRINTF(buf, sizeof(buf), "EX039%d;", ex039);
n = write(fd, buf, strlen(buf));
SNPRINTF(resp, sizeof(resp), "EX039%d;", ex039);
n = write(fd, resp, strlen(resp));
}
else if (strncmp(buf, "EX039", 5) == 0)
{
@ -424,8 +332,8 @@ int main(int argc, char *argv[])
}
else if (strcmp(buf, "LK;") == 0)
{
SNPRINTF(buf, sizeof(buf), "LK%d;", lk);
n = write(fd, buf, strlen(buf));
SNPRINTF(resp, sizeof(resp), "LK%d;", lk);
n = write(fd, resp, strlen(resp));
}
else if (strncmp(buf, "LK", 3) == 0)
{
@ -433,18 +341,18 @@ int main(int argc, char *argv[])
}
else if (strncmp(buf, "DT0;", 4) == 0)
{
SNPRINTF(buf, sizeof(buf), "DT020221022;");
n = write(fd, buf, strlen(buf));
SNPRINTF(resp, sizeof(resp), "DT020221022;");
n = write(fd, resp, strlen(resp));
}
else if (strncmp(buf, "DT1;", 4) == 0)
{
SNPRINTF(buf, sizeof(buf), "DT1222100;");
n = write(fd, buf, strlen(buf));
SNPRINTF(resp, sizeof(resp), "DT1222100;");
n = write(fd, resp, strlen(resp));
}
else if (strncmp(buf, "DT2;", 4) == 0)
{
SNPRINTF(buf, sizeof(buf), "DT2+0500;");
n = write(fd, buf, strlen(buf));
SNPRINTF(resp, sizeof(resp), "DT2+0500;");
n = write(fd, resp, strlen(resp));
}
@ -453,6 +361,14 @@ int main(int argc, char *argv[])
fprintf(stderr, "Unknown command: '%s'\n", buf);
}
if (pbuf)
{
printf("Resp:%s\n", pbuf);
}
else if (resp[0])
{
printf("Resp:%s\n", resp);
}
}
return 0;