MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / main

Function main

simulators/simft710.c:55–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53
54
55int main(int argc, char *argv[])
56{
57 char buf[BUFSIZE];
58 char *pbuf;
59 int n;
60 int fd = openPort(argv[1]);
61
62 while (1)
63 {
64 if (getmyline(fd, buf))
65 {
66// printf("Cmd:%s\n", buf);
67 }
68 else { continue; }
69
70 if (strcmp(buf, ";") == 0)
71 {
72 pbuf = "?;";
73 n = write(fd, pbuf, strlen(pbuf));
74 }
75 else if (strcmp(buf, "RM4;") == 0)
76 {
77 hl_usleep(50 * 1000);
78 pbuf = "RM4100;";
79 n = write(fd, pbuf, strlen(pbuf));
80
81 if (n <= 0) { perror("RM4"); }
82 }
83 else if (strcmp(buf, "RM5;") == 0)
84 {
85 static int power = 0;
86 power += 5;
87
88 if (power > 255) { power = 0; }
89
90 hl_usleep(50 * 1000);
91 snprintf(buf, sizeof(buf), "RM5%03d000;", power);
92 n = write(fd, buf, strlen(buf));
93
94 if (n <= 0) { perror("RM5"); }
95 }
96 else if (strcmp(buf, "RM6;") == 0)
97 {
98 hl_usleep(50 * 1000);
99 pbuf = "AN030;";
100 n = write(fd, pbuf, strlen(pbuf));
101
102 if (n <= 0) { perror("AN"); }
103 }
104 else if (strcmp(buf, "IF;") == 0)
105 {
106 hl_usleep(50 * 1000);
107 pbuf = "IF059014200000+000000700000;";
108 n = write(fd, pbuf, strlen(pbuf));
109
110 if (n <= 0) { perror("IF"); }
111 }
112 else if (strcmp(buf, "FA;") == 0)

Callers

nothing calls this directly

Calls 3

openPortFunction · 0.85
getmylineFunction · 0.85
hl_usleepFunction · 0.85

Tested by

no test coverage detected