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

Function main

tests/cachetest.c:41–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39
40
41int main(int argc, char *argv[])
42{
43 RIG *my_rig;
44 char *rig_file, *info_buf;
45 freq_t freq;
46 int retcode;
47 int model;
48 int baud;
49 int loops;
50 int cache_timeout = 500;
51 int i;
52 struct timespec start, startall;
53
54 if (argc < 5)
55 {
56 fprintf(stderr, "Usage: %s model port baud loops [cachetimems]\n", argv[0]);
57 fprintf(stderr,
58 "cachetimems defaults to 500ms, 0 to disable or pick your own cache time\n");
59 fprintf(stderr, "To test rigctld: %s 2 127.0.0.1:4532 0 1000 500\n", argv[0]);
60 exit(1);
61 }
62
63 model = atoi(argv[1]);
64 baud = atoi(argv[3]);
65 loops = atoi(argv[4]);
66
67 if (argc == 6)
68 {
69 cache_timeout = atoi(argv[5]);
70 }
71
72 rig_set_debug(RIG_DEBUG_NONE);
73
74 /* Instantiate a rig */
75 my_rig = rig_init(model); // your rig model.
76
77 /* Set up serial port, baud rate */
78 rig_file = argv[2]; // your serial device
79
80 strncpy(RIGPORT(my_rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
81
82 RIGPORT(my_rig)->parm.serial.rate = baud; // your baud rate
83
84 /* Open my rig */
85 retcode = rig_open(my_rig);
86
87 if (retcode != RIG_OK)
88 {
89 fprintf(stderr, "%s: rig_open failed %s\n", __func__,
90 rigerror(retcode));
91 return 1;
92 }
93
94 rig_set_cache_timeout_ms(my_rig, HAMLIB_CACHE_ALL, cache_timeout);
95 /* Give me ID info, e.g., firmware version. */
96 info_buf = (char *)rig_get_info(my_rig);
97
98 if (info_buf)

Callers

nothing calls this directly

Calls 14

rig_set_debugFunction · 0.85
rig_openFunction · 0.85
rigerrorFunction · 0.85
rig_set_cache_timeout_msFunction · 0.85
rig_get_infoFunction · 0.85
elapsed_msFunction · 0.85
rig_get_vfoFunction · 0.85
rig_strvfoFunction · 0.85
rig_get_freqFunction · 0.85
rig_get_modeFunction · 0.85
rig_strrmodeFunction · 0.85
rig_get_pttFunction · 0.85

Tested by

no test coverage detected