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

Function main

simulators/simtmd710.c:42–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40
41
42int main(int argc, char *argv[])
43{
44 char buf[BUFSIZE];
45 int fd = openPort(argv[1]);
46
47 while (1)
48 {
49 buf[0] = 0;
50
51 if (_getmyline(fd, buf) > 0) { printf("Cmd:%s\n", buf); }
52
53 if (strncmp(buf, "BC", 2) == 0)
54 {
55 SNPRINTF(buf, sizeof(buf), "BC %d,%d%c", vfo, vfo_tx, 0x0d);
56 printf("R:%s\n", buf);
57 write(fd, buf, strlen(buf));
58 continue;
59 }
60 else if (strncmp(buf, "FO", 2) == 0)
61 {
62 char vfon = buf[3];
63 int frequency;
64 const char tone_frequency[] = "10"; // 94.8
65 const char ctcss_frequency[] = "05"; // 79,7
66 const char dcs_frequency[] = "016"; // 114
67
68 if (vfon == '0') {
69 frequency = (int)freqA;
70 } else {
71 frequency = (int)freqB;
72 }
73 SNPRINTF(buf, sizeof(buf), "FO %c,%.10d,0,0,0,0,0,0,%.2s,%.2s,%.3s,00000000,0%c",
74 vfon, frequency, tone_frequency, ctcss_frequency, dcs_frequency, 0x0d);
75
76 printf("R:%s\n", buf);
77 write(fd, buf, strlen(buf));
78 continue;
79 }
80 else if (strlen(buf) > 0)
81 {
82 fprintf(stderr, "Unknown command: %s\n", buf);
83 }
84 }
85
86 return 0;
87}

Callers

nothing calls this directly

Calls 2

openPortFunction · 0.85
_getmylineFunction · 0.70

Tested by

no test coverage detected