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

Function main

tests/cachetest2.c:23–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22
23int main(int argc, const char *argv[])
24{
25 RIG *my_rig;
26 char *rig_file, *info_buf;
27 int retcode;
28 int model;
29 int cache_timeout = 0;
30
31 if (argc != 1)
32 {
33 fprintf(stderr, "Usage: %s\n", argv[0]);
34 exit(1);
35 }
36
37 model = 2;
38
39 rig_set_debug(RIG_DEBUG_NONE);
40
41 /* Instantiate a rig */
42 my_rig = rig_init(model); // your rig model.
43
44 /* Set up serial port, baud rate */
45 rig_file = "127.0.0.1:4532"; // your serial device
46
47 strncpy(RIGPORT(my_rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
48
49 /* Open my rig */
50 retcode = rig_open(my_rig);
51
52 if (retcode != RIG_OK)
53 {
54 fprintf(stderr, "%s: rig_open failed %s\n", __func__,
55 rigerror(retcode));
56 return 1;
57 }
58
59 rig_set_cache_timeout_ms(my_rig, HAMLIB_CACHE_ALL, cache_timeout);
60 /* Give me ID info, e.g., firmware version. */
61 info_buf = (char *)rig_get_info(my_rig);
62
63 if (info_buf)
64 {
65 strtok(info_buf, "\r\n");
66 printf("Rig_info: '%s'\n", info_buf);
67 }
68
69 while (1)
70 {
71 static freq_t freq, freq_last = 0;
72 static rmode_t mode, mode_last = 0;
73 static pbwidth_t width, width_last = 0;
74 static vfo_t vfo, vfo_last = RIG_VFO_NONE;
75 static vfo_t txvfo, txvfo_last = RIG_VFO_NONE;
76 static ptt_t ptt, ptt_last = -1;
77 static split_t split, split_last = -1;
78
79 retcode = rig_get_vfo(my_rig, &vfo);
80

Callers

nothing calls this directly

Calls 13

rig_set_debugFunction · 0.85
rig_openFunction · 0.85
rigerrorFunction · 0.85
rig_set_cache_timeout_msFunction · 0.85
rig_get_infoFunction · 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
rig_get_split_vfoFunction · 0.85

Tested by

no test coverage detected