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

Function main

tests/dumpmem.c:40–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38
39
40int main(int argc, const char *argv[])
41{
42 RIG *my_rig;
43 int status, i, j;
44
45 if (argc != 2)
46 {
47 fprintf(stderr, "%s <rig_num>\n", argv[0]);
48 exit(1);
49 }
50
51 my_rig = rig_init(atoi(argv[1]));
52
53 if (!my_rig)
54 {
55 fprintf(stderr, "Unknown rig num: %d\n", atoi(argv[1]));
56 fprintf(stderr, "Please check riglist.h\n");
57 exit(1); /* whoops! something went wrong (mem alloc?) */
58 }
59
60 strncpy(RIGPORT(my_rig)->pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1);
61
62 if (rig_open(my_rig))
63 {
64 exit(2);
65 }
66
67 status = rig_set_vfo(my_rig, RIG_VFO_B);
68
69
70 if (status != RIG_OK)
71 {
72 printf("rig_set_vfo: error = %s \n", rigerror(status));
73 }
74
75 /*
76 * chan_t is used to describe what memory your rig is equipped with
77 * cf. chan_list field in caps
78 * Example for the Ic706MkIIG (99 memory channels, 2 scan edges, 2 call chans):
79 * chan_t chan_list[] = {
80 * { 1, 99, RIG_MTYPE_MEM, 0 },
81 * { 100, 103, RIG_MTYPE_EDGE, 0 },
82 * { 104, 105, RIG_MTYPE_CALL, 0 },
83 * RIG_CHAN_END
84 * }
85 */
86 struct rig_state *rs = STATE(my_rig);
87
88 for (i = 0; rs->chan_list[i].type; i++)
89 {
90 for (j = rs->chan_list[i].startc;
91 j <= rs->chan_list[i].endc; j++)
92 {
93 dump_chan(my_rig, j);
94 }
95 }
96
97 rig_close(my_rig); /* close port */

Callers

nothing calls this directly

Calls 6

rig_openFunction · 0.85
rig_set_vfoFunction · 0.85
rigerrorFunction · 0.85
rig_closeFunction · 0.85
rig_cleanupFunction · 0.85
dump_chanFunction · 0.70

Tested by

no test coverage detected